1.

Number of destructors called are ____________(a) Always equal to number of constructors called(b) Always less than the number of constructors called(c) Always greater than the number of constructors called(d) Always less than or equal to number of constructorsThis question was addressed to me during a job interview.I need to ask this question from Execution of Constructor or Destructor in section Constructors and Destructors of Object Oriented Programming

Answer»

Right answer is (a) ALWAYS equal to NUMBER of CONSTRUCTORS called

The explanation is: DESTRUCTOR will be called only to free the resources allocated for an object. The resources are allocated only the constructor for an object is called.



Discussion

No Comment Found

Related InterviewSolutions