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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / bheda govind

Assignment operater are types,
(1)simple
(2)compond a+=5
(3)expresion a=a+b

Is This Answer Correct ?    1 Yes 0 No

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

Answer / dee

assignment operator copies the values of one object to
another of the same class.It will excute only when the
right side of the variable is object and two sides are not
equal.It does shallow copy

Copy constructor craetes the object if its not existing and
copies the values of another object of the same class and
it does the deep copy.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C++ General Interview Questions

When is the destructor called?

0 Answers  


How long does this loop run: for(int x=0; x=3; x++) a) Never b) Three times c) Forever

17 Answers   Datavance, Quark, VEL, Wipro,


What is stoi in c++?

0 Answers  


What does flush do c++?

0 Answers  


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

0 Answers   Agilent, Tavant Technologies, Thomson Reuters, Verifone,






Implement a 2 dimensional array by one dimentional array

1 Answers   CTS,


Explain the uses oof nested class?

0 Answers  


How does code-bloating occur in c++?

0 Answers  


In a function declaration, what does extern mean?

0 Answers  


Why c++ does not have finally?

0 Answers  


What is c++ coding?

0 Answers  


What are pointer-to-members in C++? Give their syntax.

0 Answers   HAL,


Categories