Sunday, 28 April 2013

What is the diffrence between a "assignment operator" and a "copy constructor"? | C#.Net Interview Questions

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

No comments: