+ 2
The normal constructor is used when you are passing the required all fields to the constructor.
If you are trying to create an object which copies data members from some other object, then copy constructor is used. If you don't define any copy constructor also, a default is provided by the compiler which does the member by member copy.
For example.
class Point {
private:
int x,y;
public:
Point(int x1, int y1) {
this.x = x1;
this.y = y1;
}
//Copy construtor
Point(const Point& p) {
this.x = p.x;
this.y = p.y;
}
};
Point p(1,2); //Normal constructor
Pont p1 = p; //Calls the copy constructor
However in the above example, the copy constructor does not do anything better than the default copy constructor provided by the compiler. However if the data members are not just plain variables, but pointers, then that we need to take special care while copying the data.