When is copy constructor used in a program?
The copy constructor takes an object as argument and is used to copy values of data members of one object into other object.