Destructors
From cppreference.com
A destructor is a member function that gets called each time an object goes out of scope or is deleted from memory. The purpose of the destructor is to free resources that the object may have acquired during its lifetime.
If not defined by the user, the compiler will generate one.
[edit] Syntax
~ClassName ( ) ; | |||||||||
virtual ~ClassName ( ) ; | |||||||||
[edit] Example
Output:
~a2 ~a3 ~a1