What is a conversion constructor?

          
Interview questions

What is a conversion constructor?


<<Previous  Next>>

C++  - What is a conversion constructor? - Feb 23, 2010 at 11:00 PM by Rajmeet Ghai

What is a conversion constructor?  

Conversion constructors are used for type conversion wherein the type of argument passed is converted to the class type.

Example:
conversion from type int to Point.
class Point
{
public:
      Point();
      Point( int );
      //...
};

C++  - What is a conversion constructor? - March 08, 2009 at 16:20 PM by Nishant Kumar

What is a conversion constructor?  

It is a constructor that accepts one argument of a different type.

Also read

Explain constructors and destructors.

Constructors are the member functions of the class that executes automatically whenever an object.......

What is a constructor?

Constructors allow initialization of objects at the time of their creation. Constructor function is a special function that is a member of the class and has same name as that of the class. An object’s constructor..............

What are the restrictions apply to constructors and destructors?

The following restrictions apply to constructors and destructors

Constructors and destructors don't return values.
The addresses of constructors and destructors can't be taken so we can't use references and pointers on them................

<<Previous  Next>> 

Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
 
Home | Want a Job? Submit Key Skills | Employer login | My key skills | About us | Sitemap | Contact us