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

Describe the advantage of an external iterator.

0 Answers  


Can you please explain the difference between static and dynamic binding of functions?

0 Answers  


What is the output of printf("%d")?

58 Answers   CTS, HCL, Infosys, TCS, Winit, Wipro,


What is math h in c++?

0 Answers  


Can you explain the term "resource acquisition is initialization?"

1 Answers   Amazon,






What is the main use of c++?

0 Answers  


Explain one-definition rule (odr).

0 Answers  


What are member functions used in c++?

0 Answers  


Give a very good method to count the number of ones in a "n" (e.g. 32) bit number.

3 Answers  


What does extern mean in a function declaration in c++?

0 Answers  


What is do..while loops structure?

0 Answers  


Why namespace is used in c++?

0 Answers  


Categories