The features of copy constructors are
- copy constructor is a special type of parameterized constructor.
- It is normally used to copy one object into another.
- They are normally used to initialize object with values of already existing object.
- Copy constructors should have at least one argument of the same class and must be passed as a constant reference type.
- The copy constructor cannot be invoked explicitly but can be equated to an already existing object in the declaration itself.
For example:
x a1; _ _ _ default constructor invoked
X a2 = a1; _ _ _ copy constructor invoked.
The C++ compiler creates default copy constructor automatically.