What is the Diffrence between a "assignment operator" and a
"copy constructor"?

Answer Posted / kishore

Copy constructors are used during class object
initialization and assignment operators are invoked during
object assignment.

XYZ c;
XYZ Obj = c; -> invoke copy constructor
XYZ d;
d = c; -> invoke assignment operator

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is prototype for that c string function?

689


Is c# written in c++?

518


What are the advantages of using a pointer?

604


What is scope resolution operator in c++ with example?

553


What are signs of manipulation?

587






Do inline functions improve performance?

648


Differentiate between a pointer and a reference with respect to c++.

695


Why do we use vector in c++?

600


What does iomanip mean in c++?

601


What is this pointer in c++?

733


Distinguish between a # include and #define.

645


How do pointers work?

703


What are static variables?

617


What is do..while loops structure?

617


Why would you use pointers in c++?

623