Amazon Interview Question
Software Engineer / DevelopersThey are the same... In the sense both of them perform a shallow copy by default. You can override the default copy constructor or overload the assignment operator for a deep copy.
"They are the same... In the sense"....should tell you something...apart from the implied difference i thought everyone knew that calling a copy constructor would involve creating a new object whereas an assignment operator could be between two existing objects..
sample x1=x2; //calls copy constructor
- Anonymous July 14, 2009sample x1;
x1=x2 ; //calls assignment operator