によると:http://www.cplusplus.com/doc/tutorial/classes/
デストラクタは、コンストラクタの反対の機能を果たします。オブジェクトが破棄されると、オブジェクトの存在範囲が終了した場合 (たとえば、関数内でローカル オブジェクトとして定義され、関数が終了した場合)、または動的に割り当てられたオブジェクトであり、解放された場合に自動的に呼び出されます。演算子 delete を使用します。
コード例:
class Something
{
public:
Something() {cout << "construction called" << endl; }
~Something() { cout << "destruction called" << endl; }
};
void foo(){
Something *ob = new Something();
}
int _tmain(int argc, _TCHAR* argv[])
{
foo();
}