Copy Constructor in C++

Copy Constructor is a type of constructor which is used to create a copy of an already existing object of a class type. It is usually of the form X (X&), where X is the class name.he compiler provides a default Copy Constructor to all the classes.

Syntax of Copy Constructor

class-name (class-name &)
{
. . . .
}

As it is used to create an object, hence it is called a constructor. And, it creates a new object, which is exact copy of the existing copy, hence it is called copy constructor.