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 |
Where and why do I have to put the "template" and "typename" keywords?
How do you link a C++ program to C functions?
Define a program that reads two matrices of size 3x3 with real values from the user then prints their sum, difference and multiplication.
What is the default access level?
What do you understand by a pure virtual member function?
Comment on assignment operator in c++.
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
What is DlgProc?
write a c++ program that gives output 4 3 4 2 3 4 1 2 3 4 using looping statement
What does extern mean in a function declaration in c++?
What are compilers in c++?
Define a pointer to a data member of the type pointer to pointer?