Answer Posted / guest
You use the assignment operator (operator = ()) whenever an
existing object is to be replaced with a different object.
The copy constructor X(const X&) is used to create a new
instance of an X-object exactly like another.
Notice the subtle difference. Assignment changes an existing
object while construction creates a new object. You can view
assignment as the application of a destructor, to flush away
the existing object, followed by a copy construction, to
make an exact copy of the assigned object.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How do you use inheritance in unity?
What is the difference between a constructor and a destructor?
what type of question are asked in thoughtworks pair programming round ?
When not to use object oriented programming?
What is object in oops?
Why do we use oop?
What is encapsulation example?
write a programe to calculate the simple intrest and compund intrest using by function overlading
What is interface in oop?
i am getting an of the type can not convert int to int *. to overcome this problem what we should do?
How to call a non virtual function in the derived class by using base class pointer
What is the difference between procedural programming and oops?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What do you mean by overloading?
What is the point of polymorphism?