ProAnswers.org

What is copy constructor?

1 Like

Constructor which initializes the it’s object member variables ( by
shallow copying) with another object of the same class. If you don’t implement one in your class
then compiler implements one for you. for example:
(a)anant Obj1(10); // calling anant constructor
(b)anant Obj2(Obj1); // calling anant copy constructor
© anant Obj2 = Obj1;// calling anant copy constructor