In assignment operator, you are assigning a value to an existing object. But in copy constructor, you are creating a new object and then assigning a value to that object.
For example:
complex c1,c2;
c1=c2; //this is assignment
complex c3=c2; //copy constructor
For example:
complex c1,c2;
c1=c2; //this is assignment
complex c3=c2; //copy constructor
No comments:
Post a Comment