0

Can any one explain what is copy constructor?

I tried but i am not getting how it works...

14th Sep 2018, 4:43 AM
Max Vhanamane
Max Vhanamane - avatar
2 Answers
+ 3
A constructor which takes an object of it's own class as an argument to initialize a new object, is a copy constructor. E.g. class A { //... }; int main() { A obj; // some operations with obj A obj2(obj); // obj2 initialized using obj }
14th Sep 2018, 5:11 AM
Hatsy Rei
Hatsy Rei - avatar
0
Ok.. Thanks Hasty for answering my question..
14th Sep 2018, 6:49 PM
Max Vhanamane
Max Vhanamane - avatar