1.

Which among the following best describes destructor?(a) A function which is called just before the objects are destroyed(b) A function which is called after each reference to the object(c) A function which is called after termination of the program(d) A function which is called before calling any member functionI have been asked this question in an online quiz.I would like to ask this question from Execution of Constructor or Destructor in section Constructors and Destructors of Object Oriented Programming

Answer»

Correct choice is (a) A FUNCTION which is called just before the objects are destroyed

Best EXPLANATION: The DESTRUCTORS are special functions which are called just before an object is destroyed. This functions is responsible to free all the ALLOCATED resources to the object. Objects are destroyed WHENEVER those go out of scope.



Discussion

No Comment Found

Related InterviewSolutions