<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 8.6 &#8212; Destructors</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/86-destructors/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/86-destructors/</link>
	<description></description>
	<pubDate>Wed, 20 Aug 2008 08:25:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Daniel</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-23180</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Sat, 09 Aug 2008 01:02:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-23180</guid>
		<description>OK thanks mate! These tutorials are the best!</description>
		<content:encoded><![CDATA[<p>OK thanks mate! These tutorials are the best!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-23157</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 08 Aug 2008 17:31:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-23157</guid>
		<description>I plan to do so after I finish the much-delayed ending to the chapter on Templates.</description>
		<content:encoded><![CDATA[<p>I plan to do so after I finish the much-delayed ending to the chapter on Templates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moonrat</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-22388</link>
		<dc:creator>moonrat</dc:creator>
		<pubDate>Thu, 31 Jul 2008 13:23:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-22388</guid>
		<description>std::cout &#60;&#60; &#34;Constructing Simple &#34; &#60;&#60; nID&#60;&#60; endl;
and
std::cout &#60;&#60; &#34;Destructing Simple&#34; &#60;&#60; m_nID &#60;&#60; endl;

should have std::endl; :)

Great tutorials btw; already had a basic grasp of C, but really like the ideas and usage of classes in OOP.

[ Fixed!  Thanks -Alex ]</description>
		<content:encoded><![CDATA[<p>std::cout &lt;&lt; &quot;Constructing Simple &quot; &lt;&lt; nID&lt;&lt; endl;<br />
and<br />
std::cout &lt;&lt; &quot;Destructing Simple&quot; &lt;&lt; m_nID &lt;&lt; endl;</p>
<p>should have std::endl; :)</p>
<p>Great tutorials btw; already had a basic grasp of C, but really like the ideas and usage of classes in OOP.</p>
<p>[ Fixed!  Thanks -Alex ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-21726</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 24 Jul 2008 08:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-21726</guid>
		<description>Would you be able to write a tutorial on exceptions, I've just started using them after reading about them on other sites but this site doesn't really cover them yet.

Thanks, Daniel</description>
		<content:encoded><![CDATA[<p>Would you be able to write a tutorial on exceptions, I&#8217;ve just started using them after reading about them on other sites but this site doesn&#8217;t really cover them yet.</p>
<p>Thanks, Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-21659</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 24 Jul 2008 01:13:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-21659</guid>
		<description>As far as I know, there's no way to explicitly call the destructor on an exit() call.

However, instead of using exit() to terminate your program, there are other options.  One way is to design your program so it "exits normally" (eg. at the end of main) instead of wherever it happens to be at the moment.  A related idea is to throw an exception and catch it in main(), allowing the program to exit normally.</description>
		<content:encoded><![CDATA[<p>As far as I know, there&#8217;s no way to explicitly call the destructor on an exit() call.</p>
<p>However, instead of using exit() to terminate your program, there are other options.  One way is to design your program so it &#8220;exits normally&#8221; (eg. at the end of main) instead of wherever it happens to be at the moment.  A related idea is to throw an exception and catch it in main(), allowing the program to exit normally.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20701</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 11 Jul 2008 03:18:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20701</guid>
		<description>Thanks,

QUOTE: assuming you don’t exit() early
ah, is there an easy way around this? to call the destructor on an exit() call?</description>
		<content:encoded><![CDATA[<p>Thanks,</p>
<p>QUOTE: assuming you don’t exit() early<br />
ah, is there an easy way around this? to call the destructor on an exit() call?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20682</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 11 Jul 2008 01:56:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20682</guid>
		<description>I find a lot of time when I have questions in C++ I can answer them just by writing a test program like you did.

The answer is that when you have static variables, they get constructed before main() and destructed just before your program ends (assuming you don't exit() early)</description>
		<content:encoded><![CDATA[<p>I find a lot of time when I have questions in C++ I can answer them just by writing a test program like you did.</p>
<p>The answer is that when you have static variables, they get constructed before main() and destructed just before your program ends (assuming you don&#8217;t exit() early)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20271</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 03 Jul 2008 11:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20271</guid>
		<description>Well I just did a test myself and found that it was as I expected called at the end of the programme if anyone else wants to try this them selves this is what I did
#include &#60;iostream&#62;
using namespace std;

class basic
{
  public:
    basic() {
        cout &#60;&#60; &#34;constructor called&#34; &#60;&#60; endl;
    }

    ~basic() {
        cout &#60;&#60; &#34;destructor called&#34; &#60;&#60; endl;
    }
};

static basic myThing;

int main()
{

    system(&#34;pause&#34;);
    return 0;
}
It outputs:
constructor called
pause stuff
destructor called</description>
		<content:encoded><![CDATA[<p>Well I just did a test myself and found that it was as I expected called at the end of the programme if anyone else wants to try this them selves this is what I did<br />
#include &lt;iostream&gt;<br />
using namespace std;</p>
<p>class basic<br />
{<br />
  public:<br />
    basic() {<br />
        cout &lt;&lt; &quot;constructor called&quot; &lt;&lt; endl;<br />
    }</p>
<p>    ~basic() {<br />
        cout &lt;&lt; &quot;destructor called&quot; &lt;&lt; endl;<br />
    }<br />
};</p>
<p>static basic myThing;</p>
<p>int main()<br />
{</p>
<p>    system(&quot;pause&quot;);<br />
    return 0;<br />
}<br />
It outputs:<br />
constructor called<br />
pause stuff<br />
destructor called</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20261</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 03 Jul 2008 08:14:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-20261</guid>
		<description>If I have a class named "thing" and I create a static instance of that class named "myThing" like this "static thing myThing". Is the destructor called on this instance? If so when? I would assume it would at the end of the programme but I really don't know.</description>
		<content:encoded><![CDATA[<p>If I have a class named &#8220;thing&#8221; and I create a static instance of that class named &#8220;myThing&#8221; like this &#8220;static thing myThing&#8221;. Is the destructor called on this instance? If so when? I would assume it would at the end of the programme but I really don&#8217;t know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 8.5 &#8212; Constructors</title>
		<link>http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-14392</link>
		<dc:creator>Learn C++ - &#187; 8.5 &#8212; Constructors</dc:creator>
		<pubDate>Mon, 05 May 2008 01:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/86-destructors/#comment-14392</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 8.4 &#8212; Access functions and encapsulation &#124; Home &#124; 8.6 &#8212; Destructors &#187;     Wednesday, September 5th, 2007 at 3:10 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 8.4 &#8212; Access functions and encapsulation | Home | 8.6 &#8212; Destructors &raquo;     Wednesday, September 5th, 2007 at 3:10 [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
