1.

When a destructor is called?(a) After the end of object life(b) Anytime in between object’s lifespan(c) At end of whole program(d) Just before the end of object lifeThis question was posed to me in an interview for job.I need to ask this question from Destructors topic in portion Constructors and Destructors of Object Oriented Programming

Answer»

Correct option is (d) Just before the end of OBJECT life

Easiest explanation - The DESTRUCTOR is called just before the object go out of scope or just before its life ends. This is done to ensure that all the resources reserved for the object are USED and at last, are made free for others.



Discussion

No Comment Found

Related InterviewSolutions