System will call the destructor
#include <iostream> using namespace std; class myclass { public: int who; myclass(int id); ~myclass(); }; myclass::myclass(int id) { cout << "Initializing " << id << endl; who = id; } myclass::~myclass() { cout << "Destructing " << who << endl; } int main() { myclass object1(3); cout << "Here.\n"; myclass object2(4); return 0; }