When a destructor is called?

Trương Duy

New member
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 life
 
Answer: d
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.
 

Tìm kiếm

Back
Top