Abstraction Mechanisms, Part 1
- slide 20 : 36
Classes and Conversion: Examples
Illustrates conversion between a built-in type and a user defined type:
double
and
Point
Class Point with conversion constructor and conversion operator, from and to double.
Class Point implementation.
Use implicit of the conversions.
Program output.
The following illustrates conversion between user-defined types:
Point
and
Tripple
Class Tripple with Tripple(Point) constructor and a Point conversion operator.
Class Tripple implementation.
Illustration of conversions.
Program output.
Conversion via constructors