
Operator Overloading 187
Object of one class into
object of another class
i. Defining conversion operator in the class whose object is converted
into other type of object.
CuboidMetal t1("Silver",7.0,24.0, 25.0,10.5);
Rectangular_Metal t4("Silver",11.45,11.66);
t4=t1; //Assigning base,height of t1 to length,breadth
// of t4 by calling conversion operator
ii. Defining the constructor in a class that accepts the object of another
class as a parameter and converts it into the object of its type.
CuboidMetal t1("Silver",7.0,24.0, 25.0,10.5);
Rectangular_Metal t4("Silver",11.45,11.66);
t4=t1; // Calls constructor of Rectangular_Metal class
// that accpets ...