1.

Define A Conversion Constructor?

Answer»

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.

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

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.

The above example has the following two conversion constructors:



Discussion

No Comment Found