InterviewSolution
Saved Bookmarks
| 1. |
Which function is called whenever an object goes out of scope?(a) Destructor function(b) Constructor function(c) Delete function(d) Free functionI have been asked this question by my college professor while I was bunking the class.Question is taken from Memory Allocation of Object in portion Object of Object Oriented Programming |
|
Answer» CORRECT choice is (a) Destructor function Explanation: The destructor function of the CLASS is called whenever an object goes out of scope. This is because the destructor set all the RESOURCES, acquired by the object, FREE. This is an implicit work of compiler. |
|