How copy constructor works?

Showing Answers 1 - 7 of 7 Answers

saurabh08_chd

  • Mar 13th, 2007
 

alpha a2(a1);
The compiler creates a new object a2 , and copies the data from a1 , member by member into a2. This is the default action of copy constructor

Raju

  • Mar 20th, 2007
 

Copy Constructor uses class name as reference .., it is used to declare and Initialize an object from another object. i.e It is used to create a new object from existing object of same class.

  Was this answer useful?  Yes

Copy Constructor :- This is among one of the default method of class.

Base a;

Base b = a ; // Here Copy constructor gets called.

Here a new instance of class Base will be created and object a data will be copied in object b.

Sachin Mundhra

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions