Why a "operator=(...)" when there is a copy ctor?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / arun
Copy Constructor means creation of new object and after that
copy properties of some exiting object to newly created object.
Overloading assignment operator is that copy properties of
some exiting object to another exiting object of same type.
| Is This Answer Correct ? | 1 Yes | 0 No |
Prepare me a program for the animation of train
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
When will a constructor executed?
What is class in oop with example?
what is main difference between object oriented object base
What does I oop mean?
pointers are support in C#? if yes then how to use it?
8 Answers Softvision Solution,
What is virtual function?where and when is it used?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
what is oops
What is advantage of inheritance?
what is multi level inheritance give n example ?
13 Answers HDFC, Hulas Steel, Ness Technologies,