1.

Assignment Operator - What Is The Diffrence Between A "assignment Operator" And A "copy Constructor"?

Answer»

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 cl,c2; cl=c2; //this is assignment complex c3=c2; //copy constructor.

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:



Discussion

No Comment Found