1.

Which function is called whenever an object goes out of scope?(a) Destructor function(b) Constructor function(c) Delete function(d) Free functionThe question was posed to me in an interview for job.My question is from Overloading Member Functions topic in section Member Functions & its Types of Object Oriented Programming

Answer»

The CORRECT choice is (a) Destructor function

To EXPLAIN: 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.



Discussion

No Comment Found

Related InterviewSolutions