1.

Which among the following describes a destructor?(a) A special function that is called to free the resources, acquired by the object(b) A special function that is called to delete the class(c) A special function that is called anytime to delete an object(d) A special function that is called to delete all the objects of a classI have been asked this question during an interview.The above asked question is from Destructors topic in section Constructors and Destructors of Object Oriented Programming

Answer»

Right ANSWER is (a) A special function that is called to free the resources, acquired by the object

Easiest explanation - It is USED to free the resources that the object might had used in its LIFESPAN. The DESTRUCTORS are called implicitly whenever an object’s life ends.



Discussion

No Comment Found

Related InterviewSolutions