 <p>In the usual case destructor is not caused for objects created in <strong><code>main()</code></strong>. But there is a good &amp; elegant solution - you can put your code into the <strong>extra parentheses</strong>, and then the destructor will be invoked:</p> <pre><code>int main() { { myApp app; app.run(); getchar(); } // At this point, the object's destructor is invoked } </code></pre>