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 |
What is the Advantage of Interface over the Inheritance in OOPS?
What is polymorphism? Explain with an example.
What is polymorphism ? Explain with examples
Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.....
4 Answers Bally Technologies, IBM, SoftSol,
Which is the only operator in C++ which can be overloaded but NOT inherited?
Explain the concept of abstracion and encapsulation with one example. What is the difference between them?
In which cases you use override and new base?
what is namespace? what are the uses of namespace?
What is the difference between inheritance and polymorphism?
Why static Function is used in C++?
Why polymorphism is used in oops?
The company is a fake company asking for money of RS10000 while training and not offering a job after training. My humble request to you people not to attend Astersys interview