Wednesday 22 February 2012

Define a conversion constructor? | Constructor in C++

A conversion constructor is a single argument constructor. It is used by the compiler to convert a type of object as an argument to a class type.
Program:
The above example has the following two conversion constructors:
?Y(inti)— Helps in the conversion of integers to objects of class Y
?Y(const char* n, int j = 0) —Helps in the conversion of pointers from strings to objects of the Y class