Loading practice questions
How to overcome the problem arising due to destruction of temporary object?
Correct Answer: C — Overloading assignment operator and defining copy constructor
Explanation:
The problem can be solved by overloading the assignment operator to get the values that might be getting returned while the destructor free the dynamic memory. Defining copy constructor can help us to do this in even simpler way.