There are three general cases where the copy constructor is called instead of the assignment operator:
1).When instantiating one object and initializing it with values from another object .
2).When passing an object by value.
3).When an object is returned from a function by value.
The assignment operator is used to copy the values from one object to another already existing object.
MyClass myObject1(someValueHere); MyClass myObject2; myObject2= myObject1;
In this case, myObject2 has already been created by the time the assignment is executed. Consequently, the MyClass assignment operator is called. The assignment operator needs to be overloaded as a member function.
A copy constructor is called if the object being copied into does not already exist.
MyClass myObject1(someValueHere); MyClass myObject2= myObject1;
Because the second statement uses an equals symbol in it, you might expect that it calls the assignment operator. However, it doesn’t! It actually calls a special type of constructor called a copy constructor. A copy constructor is a special constructor that initializes a new object from an existing object.
The purpose of the copy constructor and the assignment operator are almost equivalent — both copy one object to another. However, the assignment operator copies to existing objects, and the copy constructor copies to newly created objects.
do google for more
hope this helps!