ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
Is the destruction of temporary object safe (while returning object)?
Correct Answer: C — No, unexpected side effects may occur
The destruction of temporary variable may give rise to unexpected logical errors. Consider the destructor which may free the dynamically allocated memory. But this may abort the program if another is still trying to copy the values from that dynamic memory.