What is a copy constructor?

What is a copy constructor?

1 Like

Copy Constructor is a type of constructor which is used to create a copy of the already existing object of a class. It is used when we want data members of one object is initialized by the values of the data members of another.

Syntax: ClassName (const ClassName &old_obj);