1.

Which is the correct syntax to delete a single object?(a) delete *objectName;(b) objectName delete;(c) delete objectName;(d) objectName *delete;This question was posed to me in an international level competition.I'd like to ask this question from Delete Operator topic in division Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

The correct answer is (c) DELETE objectName;

EXPLANATION: The OBJECT to be deleted is mentioned after the keyword delete. This deletes the object from MEMORY and FREE up the memory that was acquired by the object.



Discussion

No Comment Found

Related InterviewSolutions