얼룩와와 2019. 10. 3. 11:22

Source: https://www.geeksforgeeks.org/destructors-c/

 

Definition

 

Destructor is a member function which destructs or deletes an object.

 

Description

 

A destructor function is called automatically when:

 

the function ends

the program ends

a block ends

(if the object is on the heap) a delete operator is called

 

A destructor should never be called directly.