<?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: 11.5 &#8212; Inheritance and access specifiers</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: qaiser abbas</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-96872</link>
		<dc:creator>qaiser abbas</dc:creator>
		<pubDate>Tue, 24 Jan 2012 10:25:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-96872</guid>
		<description>You have two classes, Class A and Class B. Being a programmer either you can implement Class B as nested class of Class A or you can inherit Class B from Class A. 
 
These are two ways to describe the relationship between classes. Discuses the situations in which, concept of public inheritance and nested class is more appropriate to use. Justify with solid reasons.

please provide the answer</description>
		<content:encoded><![CDATA[<p>You have two classes, Class A and Class B. Being a programmer either you can implement Class B as nested class of Class A or you can inherit Class B from Class A. </p>
<p>These are two ways to describe the relationship between classes. Discuses the situations in which, concept of public inheritance and nested class is more appropriate to use. Justify with solid reasons.</p>
<p>please provide the answer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikhil Singhal</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-95661</link>
		<dc:creator>Nikhil Singhal</dc:creator>
		<pubDate>Mon, 04 Jul 2011 11:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-95661</guid>
		<description>Thanks Peter 

your comment makes Alex&#039;s article more understandable, specially for Beginners, most of the times they become confused at this point, but if they follow your table they never confused  LIKE ME :)

Thanks &amp; Regards
Nikhil Singhal</description>
		<content:encoded><![CDATA[<p>Thanks Peter </p>
<p>your comment makes Alex&#8217;s article more understandable, specially for Beginners, most of the times they become confused at this point, but if they follow your table they never confused  LIKE ME :)</p>
<p>Thanks &amp; Regards<br />
Nikhil Singhal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bulyaki</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-89137</link>
		<dc:creator>Peter Bulyaki</dc:creator>
		<pubDate>Mon, 26 Jul 2010 10:11:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-89137</guid>
		<description>Very nice and thorough tutorial, however I found one very misleading point:
For public inheritance, your table says private will become private in the derived class (and you introduce an extra column to say that it is not accessible in the derved class explicitly). This is anything but true, because private will become *inaccessible* in the derived class - not private. Beginners who would take the easy way of learning, would memorize your tables, and they would easily get confused by it.

What you say is:
Public    -&gt; Public
Protected -&gt; Protected
Private   -&gt; Private

This is how I would change your table, putting a &quot;-&quot; to the appropriate cell:
public    -&gt; public
protected -&gt; protected
private   -&gt; -

Same applies to protected inheritance:
public    -&gt; protected
protected -&gt; protected
private   -&gt; -

And for private inheritance:
public    -&gt; private
protected -&gt; private
private   -&gt; -

So in my interpretation, there is an even easier way to memorize all 3*3 cases:
First, you&#039;d need to point out, that private is private. No matter how you inherit, a private member will NOT be accessible in the derived class. 

So here it is how I&#039;d let people memorize it:
0. Inheritance specifier is uninterpretable for private members.

1. PUBLIC inheritance: Everything remains the SAME in the derived class:
public    -&gt; public
protected -&gt; protected

2. PROTECTED inheritance: Everything becomes PROTECTED in the derived class:
public    -&gt; protected
protected -&gt; protected

3. PRIVATE inheritance: Everything becomes PRIVATE in the derived class:
public    -&gt; private
protected -&gt; private

This is how I was taught it, and I think that it is much simpler this way.</description>
		<content:encoded><![CDATA[<p>Very nice and thorough tutorial, however I found one very misleading point:<br />
For public inheritance, your table says private will become private in the derived class (and you introduce an extra column to say that it is not accessible in the derved class explicitly). This is anything but true, because private will become *inaccessible* in the derived class &#8211; not private. Beginners who would take the easy way of learning, would memorize your tables, and they would easily get confused by it.</p>
<p>What you say is:<br />
Public    -&gt; Public<br />
Protected -&gt; Protected<br />
Private   -&gt; Private</p>
<p>This is how I would change your table, putting a &#8220;-&#8221; to the appropriate cell:<br />
public    -&gt; public<br />
protected -&gt; protected<br />
private   -&gt; -</p>
<p>Same applies to protected inheritance:<br />
public    -&gt; protected<br />
protected -&gt; protected<br />
private   -&gt; -</p>
<p>And for private inheritance:<br />
public    -&gt; private<br />
protected -&gt; private<br />
private   -&gt; -</p>
<p>So in my interpretation, there is an even easier way to memorize all 3*3 cases:<br />
First, you&#8217;d need to point out, that private is private. No matter how you inherit, a private member will NOT be accessible in the derived class. </p>
<p>So here it is how I&#8217;d let people memorize it:<br />
0. Inheritance specifier is uninterpretable for private members.</p>
<p>1. PUBLIC inheritance: Everything remains the SAME in the derived class:<br />
public    -&gt; public<br />
protected -&gt; protected</p>
<p>2. PROTECTED inheritance: Everything becomes PROTECTED in the derived class:<br />
public    -&gt; protected<br />
protected -&gt; protected</p>
<p>3. PRIVATE inheritance: Everything becomes PRIVATE in the derived class:<br />
public    -&gt; private<br />
protected -&gt; private</p>
<p>This is how I was taught it, and I think that it is much simpler this way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ROHITH</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-87139</link>
		<dc:creator>ROHITH</dc:creator>
		<pubDate>Fri, 25 Jun 2010 06:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-87139</guid>
		<description>YES IT IS CORRECT.  IF YOU INHERIT PUBLICLY THEN ALL THE BASE SPECIFIERS WILL RETAIN THEIR ACCESS LEVEL IN DERIVED CLASS</description>
		<content:encoded><![CDATA[<p>YES IT IS CORRECT.  IF YOU INHERIT PUBLICLY THEN ALL THE BASE SPECIFIERS WILL RETAIN THEIR ACCESS LEVEL IN DERIVED CLASS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ROHITH</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-87138</link>
		<dc:creator>ROHITH</dc:creator>
		<pubDate>Fri, 25 Jun 2010 06:48:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-87138</guid>
		<description>ITS SUPERB AND THANKS A LOT.  IT GIVES A OVER ALL VIEW OF THE ACCESS SPECIFIERS STORY.


THANKS.</description>
		<content:encoded><![CDATA[<p>ITS SUPERB AND THANKS A LOT.  IT GIVES A OVER ALL VIEW OF THE ACCESS SPECIFIERS STORY.</p>
<p>THANKS.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-86880</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Sun, 20 Jun 2010 11:41:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-86880</guid>
		<description>Excellent tutorial. 
The best I&#039;ve seen so far.
Helped me a lot.
Thank you!</description>
		<content:encoded><![CDATA[<p>Excellent tutorial.<br />
The best I&#8217;ve seen so far.<br />
Helped me a lot.<br />
Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shruthi</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-86192</link>
		<dc:creator>shruthi</dc:creator>
		<pubDate>Wed, 09 Jun 2010 06:45:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-86192</guid>
		<description>Thanks!. Good explanation of the topic.</description>
		<content:encoded><![CDATA[<p>Thanks!. Good explanation of the topic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rollie</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-85792</link>
		<dc:creator>Rollie</dc:creator>
		<pubDate>Wed, 02 Jun 2010 02:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-85792</guid>
		<description>Great explanation - thanks!</description>
		<content:encoded><![CDATA[<p>Great explanation &#8211; thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: auasp</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-85458</link>
		<dc:creator>auasp</dc:creator>
		<pubDate>Thu, 27 May 2010 13:10:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-85458</guid>
		<description>Is the first table on Public inheritance correct?
I think all the entries in &quot;derived access specifier&quot; column should be Public.</description>
		<content:encoded><![CDATA[<p>Is the first table on Public inheritance correct?<br />
I think all the entries in &#8220;derived access specifier&#8221; column should be Public.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ozzy</title>
		<link>http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/comment-page-1/#comment-82289</link>
		<dc:creator>ozzy</dc:creator>
		<pubDate>Sun, 04 Apr 2010 14:03:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/115-inheritance-and-access-specifiers/#comment-82289</guid>
		<description>Very nice explanation !</description>
		<content:encoded><![CDATA[<p>Very nice explanation !</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.338 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-07 11:49:48 -->
<!-- Compression = gzip -->
