<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to Assert on Object Slicing?</title>
	<atom:link href="http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/</link>
	<description>Gold mine of Visual C++ tricks!</description>
	<lastBuildDate>Thu, 12 Jan 2012 15:10:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: GLaz</title>
		<link>http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/comment-page-1/#comment-275</link>
		<dc:creator>GLaz</dc:creator>
		<pubDate>Sun, 06 Dec 2009 12:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=918#comment-275</guid>
		<description>Without this constructor code won&#039;t even compile. Why do we need any assertions?</description>
		<content:encoded><![CDATA[<p>Without this constructor code won&#8217;t even compile. Why do we need any assertions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pizer</title>
		<link>http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/comment-page-1/#comment-274</link>
		<dc:creator>pizer</dc:creator>
		<pubDate>Thu, 12 Mar 2009 22:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=918#comment-274</guid>
		<description>I forgot to mention. If you deal with dynamically allocated polymorphic objects: Make the base class destructor either virtual or protected.</description>
		<content:encoded><![CDATA[<p>I forgot to mention. If you deal with dynamically allocated polymorphic objects: Make the base class destructor either virtual or protected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pizer</title>
		<link>http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/comment-page-1/#comment-273</link>
		<dc:creator>pizer</dc:creator>
		<pubDate>Thu, 12 Mar 2009 22:27:50 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=918#comment-273</guid>
		<description>public inheritence is kind of overused. It really only models the &quot;is-a&quot; relationship well and nothing else. public inheritence is what you use for runtime polymorphism. If runtime polymorphism is what you want, consider using smart pointers to manage the objects. Also, make the &quot;interface&quot; base class an &lt;em&gt;abstract&lt;/em&gt; class -- preferably without data members. If the base class is abstract you won&#039;t be able to define variables of type base -- only pointers or references. This will save you from slicing problems.</description>
		<content:encoded><![CDATA[<p>public inheritence is kind of overused. It really only models the &#8220;is-a&#8221; relationship well and nothing else. public inheritence is what you use for runtime polymorphism. If runtime polymorphism is what you want, consider using smart pointers to manage the objects. Also, make the &#8220;interface&#8221; base class an <em>abstract</em> class &#8212; preferably without data members. If the base class is abstract you won&#8217;t be able to define variables of type base &#8212; only pointers or references. This will save you from slicing problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jijo.Raj</title>
		<link>http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/comment-page-1/#comment-272</link>
		<dc:creator>Jijo.Raj</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=918#comment-272</guid>
		<description>Hi Navaneeth,

Yes. its true if the base class is part of framework, where all derived classes are not known. But, the idea of private constructor is great! I&#039;ll update it in the article. Thanks a lot for sharing it and Keep watching!

Regards,
Jijo.</description>
		<content:encoded><![CDATA[<p>Hi Navaneeth,</p>
<p>Yes. its true if the base class is part of framework, where all derived classes are not known. But, the idea of private constructor is great! I&#8217;ll update it in the article. Thanks a lot for sharing it and Keep watching!</p>
<p>Regards,<br />
Jijo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Navaneeth</title>
		<link>http://weseetips.com/2009/03/11/how-to-assert-on-object-slicing/comment-page-1/#comment-271</link>
		<dc:creator>Navaneeth</dc:creator>
		<pubDate>Thu, 12 Mar 2009 13:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=918#comment-271</guid>
		<description>Hi there,

This is interesting. But will work only if &quot;Derived&quot; is known at the time of writing &quot;Base&quot;. Usually you will not know who will derive when you write a base class.

How about making the base class copy protected (private copy constructor)?</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>This is interesting. But will work only if &#8220;Derived&#8221; is known at the time of writing &#8220;Base&#8221;. Usually you will not know who will derive when you write a base class.</p>
<p>How about making the base class copy protected (private copy constructor)?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

