1.

When is the memory allocated for an object gets free?(a) At termination of program(b) When object goes out of scope(c) When main function ends(d) When system restartsI got this question by my school principal while I was bunking the class.The above asked question is from Overloading Member Functions in division Member Functions & its Types of Object Oriented Programming

Answer»

Right option is (b) When OBJECT goes out of scope

Best explanation: Whenever an object goes out of scope, the deletion of allocation memory takes place. ACTUALLY the DATA is not deleted, instead the memory SPACE is flagged to be free for further use. Hence whenever an object goes out of scope the object members become useless and hence memory is set free.



Discussion

No Comment Found

Related InterviewSolutions