What is the Diffrence between a "assignment operator" and a
"copy constructor"?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
what are difference between c and c++?
Should I learn c or c++ or c#?
What is bubble sort c++?
What is pointer -to-members in C++? Give their syntax?
What is the size of a vector?
What is microsoft c++ redistributable 2013?
Which programming language is best to learn first?
What is a hash function c++?
Which programming language's unsatisfactory performance led to the discovery of c++?
What is meant by forward referencing and when should it be used?
What are the various situations where a copy constructor is invoked?
Show the declaration for a static member variable.