Difference between a copy constructor and an assignment operator.
- Copy constructor creates a new object which has the copy of the original object .
- On the other hand assignment operators does not create any new object. It instead, deals with existing objects.
Difference between a copy constructor and an assignment operator.
- A copy constructor is used to declare and initialize an object from another object.
-
Example :integer I2(I1);
- An assignment operator doesnot invoke the copy constructor. It simply assigns the values of an object to another, member by member.