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 functions syntax in c++?

811


What is setw manipulator in c++?

793


Can create new c++ operators?

744


What is increment operator in c++?

747


What is #include iostream?

965


What are c++ stream classes?

767


What do you mean by function pointer?

823


What is this pointer in c++?

1006


What are the advantages of c++?

1267


Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.

791


Write about c++ storage classes?

952


Are c and c++ similar?

785


What are pointer-to-members? Explain.

796


What is helper in c++?

819


How will you call C functions from C ++ and vice-versa?

849