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 does a 'this' pointer get created?

0 Answers  


What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal

0 Answers  


what is data abstraction in C++?

0 Answers  


What sorting algorithm does c++ use?

0 Answers  


What are the operators in c++?

0 Answers  


What are enumerations?

0 Answers  


Where Malloc(), Calloc(), and realloc() does get memory?

0 Answers  


Give 10 points of differences between C & C++.

0 Answers   HCL,


Is C++ case sensitive a) False b) Depends on implementation c) True

0 Answers  


Describe new operator and delete operator?

0 Answers  


What do you understand by pure virtual function? Write about its use?

0 Answers  


What are the benefits of pointers?

0 Answers  


Categories