CPP MCQ
What is the role of destructors in Classes?
A)
To destroy an object when the lifetime of an object ends
B)
To modify the data whenever required
C)
To call private functions from the outer world
D)
To initialize the data members of an object when it is created

Correct Answer : Option (A) :   To destroy an object when the lifetime of an object ends

Explanation : Destructors are used in Classes to destroy an object after its lifetime is over i.e. to free resources occupied by that object.