Question: Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"?
Answer: In assignment operator, you are assigning a value to an existing object. But in copy constructor, you are creating a new object and then assigning a value to that object. For example: complex c1,c2; c1=c2; //this is assignment complex c3=c2; //copy constructor
Question:
Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"? Answer:
In assignment operator, you are assigning a value to an existing object. But in copy constructor, you are creating a new object and then assigning a value to that object. For example: complex c1,c2; c1=c2; //this is assignment complex c3=c2; //copy constructor Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
There should not be any Spelling Mistakes.
There should not be any Gramatical Errors.
Answers must not contain any bad words.
Answers should not be the repeat of same answer, already approved.
Answer should be complete in itself.
Related Questions
View Answer
Write a program that ask for user input from 5 to 9 then calculate the average