ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
How to overcome the problem arising due to destruction of temporary object?
Correct Answer: C — Overloading assignment operator and defining copy constructor
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.