<?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.4 &#8212; Constructors and initialization of derived classes</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/</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: floatingDivs</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-95253</link>
		<dc:creator>floatingDivs</dc:creator>
		<pubDate>Sun, 13 Mar 2011 07:55:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-95253</guid>
		<description>&lt;q cite=&quot;http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#highlighter_125309&quot;&gt;The base class constructor Base(int) will be used to initialize m_nValue to 5, and the derived class constructor will be used to initialize m_dValue to 1.3!&lt;/q&gt;

Wouldn&#039;t it be that the base class constructor would be used to initialize m_nValue to 1.3 and derived class constructor would be used to initialize m_dValue to 5 (which wouldn&#039;t work since the base class constructor requires an integer)?</description>
		<content:encoded><![CDATA[<p><q cite="http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#highlighter_125309">The base class constructor Base(int) will be used to initialize m_nValue to 5, and the derived class constructor will be used to initialize m_dValue to 1.3!</q></p>
<p>Wouldn&#8217;t it be that the base class constructor would be used to initialize m_nValue to 1.3 and derived class constructor would be used to initialize m_dValue to 5 (which wouldn&#8217;t work since the base class constructor requires an integer)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dhaval</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-95065</link>
		<dc:creator>Dhaval</dc:creator>
		<pubDate>Tue, 21 Dec 2010 11:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-95065</guid>
		<description>Hi I have problem of calling constructor for base class from derived class. For that I have used above example. But called constructor externally.

//a.h
#ifndef A_H_
#define A_H_
#include 
class A
{
public:
    A(int nValue)
    {
        std::cout &lt;&lt; &quot;A: &quot; &lt;&lt; nValue &lt;&lt; &quot;\n&quot;;
    }
};
#endif

//b.h
#ifndef B_H_
#define B_H_
#include 
class B: public A
{
public:
    B(int nValue, double dValue)
    : A(nValue)
    {
        std::cout &lt;&lt; &quot;B: &quot; &lt;&lt; dValue &lt;&lt; &quot;\n&quot;;
    }
};
#endif

//c.h
#ifndef C_H_
#define C_H_
#include 
class C: public B
{
public:
    C(int nValue, double dValue, char chValue);
};
#endif

//c.cpp
#include 
#include &quot;a.h&quot;
#include &quot;b.h&quot;
#include &quot;c.h&quot;
C::C(int nValue, double dValue, char chValue):B(nValue, dValue)
{
        std::cout &lt;&lt; &quot;C: &quot; &lt;&lt; chValue &lt;&lt; &quot;\n&quot;;
}

//main.cpp
#include 
#include 

#include &quot;a.h&quot;
#include &quot;b.h&quot;
#include &quot;c.h&quot;

using namespace std;

int main()
{
    C cClass(5, 4.3, &#039;R&#039;);    
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}

when I compile this code I get error:
multiple definition of `C::C(int, double, char)&#039;

I dont understand why this error come. Any idea? Please let me know.</description>
		<content:encoded><![CDATA[<p>Hi I have problem of calling constructor for base class from derived class. For that I have used above example. But called constructor externally.</p>
<p>//a.h<br />
#ifndef A_H_<br />
#define A_H_<br />
#include<br />
class A<br />
{<br />
public:<br />
    A(int nValue)<br />
    {<br />
        std::cout &lt;&lt; &quot;A: &quot; &lt;&lt; nValue &lt;&lt; &quot;\n&quot;;<br />
    }<br />
};<br />
#endif</p>
<p>//b.h<br />
#ifndef B_H_<br />
#define B_H_<br />
#include<br />
class B: public A<br />
{<br />
public:<br />
    B(int nValue, double dValue)<br />
    : A(nValue)<br />
    {<br />
        std::cout &lt;&lt; &quot;B: &quot; &lt;&lt; dValue &lt;&lt; &quot;\n&quot;;<br />
    }<br />
};<br />
#endif</p>
<p>//c.h<br />
#ifndef C_H_<br />
#define C_H_<br />
#include<br />
class C: public B<br />
{<br />
public:<br />
    C(int nValue, double dValue, char chValue);<br />
};<br />
#endif</p>
<p>//c.cpp<br />
#include<br />
#include &#8220;a.h&#8221;<br />
#include &#8220;b.h&#8221;<br />
#include &#8220;c.h&#8221;<br />
C::C(int nValue, double dValue, char chValue):B(nValue, dValue)<br />
{<br />
        std::cout &lt;&lt; &quot;C: &quot; &lt;&lt; chValue &lt;&lt; &quot;\n&quot;;<br />
}</p>
<p>//main.cpp<br />
#include<br />
#include </p>
<p>#include &#8220;a.h&#8221;<br />
#include &#8220;b.h&#8221;<br />
#include &#8220;c.h&#8221;</p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
    C cClass(5, 4.3, &#8216;R&#8217;);<br />
    system(&#8220;PAUSE&#8221;);<br />
    return EXIT_SUCCESS;<br />
}</p>
<p>when I compile this code I get error:<br />
multiple definition of `C::C(int, double, char)&#8217;</p>
<p>I dont understand why this error come. Any idea? Please let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sorin</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-91732</link>
		<dc:creator>sorin</dc:creator>
		<pubDate>Thu, 09 Sep 2010 22:16:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-91732</guid>
		<description>this is a very good tutorial. thanks Alex!</description>
		<content:encoded><![CDATA[<p>this is a very good tutorial. thanks Alex!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MrAlshahawy</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-91322</link>
		<dc:creator>MrAlshahawy</dc:creator>
		<pubDate>Fri, 03 Sep 2010 13:54:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-91322</guid>
		<description>Your tutorial is more than great, Many thanks for this effort, it is really appreciated, Keep up the good work.</description>
		<content:encoded><![CDATA[<p>Your tutorial is more than great, Many thanks for this effort, it is really appreciated, Keep up the good work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TutLover</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-89266</link>
		<dc:creator>TutLover</dc:creator>
		<pubDate>Thu, 29 Jul 2010 19:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-89266</guid>
		<description>For Baseball example by default bIsMale Should be bIsMale = true when sending parameters to Person... ;p

BTW Love Your Tutorials...</description>
		<content:encoded><![CDATA[<p>For Baseball example by default bIsMale Should be bIsMale = true when sending parameters to Person&#8230; ;p</p>
<p>BTW Love Your Tutorials&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Taiwan boy</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-85803</link>
		<dc:creator>Taiwan boy</dc:creator>
		<pubDate>Wed, 02 Jun 2010 04:45:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-85803</guid>
		<description>Thanks alot, this article saves me!</description>
		<content:encoded><![CDATA[<p>Thanks alot, this article saves me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: baldo</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-66880</link>
		<dc:creator>baldo</dc:creator>
		<pubDate>Sat, 22 Aug 2009 20:18:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-66880</guid>
		<description>The advantage is only if the base class constructor changes. But if the base class constructor parameters change, then you need to rewrite all of yours derived class constructors...</description>
		<content:encoded><![CDATA[<p>The advantage is only if the base class constructor changes. But if the base class constructor parameters change, then you need to rewrite all of yours derived class constructors&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cammy</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-60335</link>
		<dc:creator>cammy</dc:creator>
		<pubDate>Sat, 09 May 2009 11:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-60335</guid>
		<description>I have been getting on well with the tutorials and have learnt a lot. I was just wondering if they cover proper OOP because, as yet, there has been none and with only a few more lessons til the end, I am getting worried that it will not be covered. For example, &quot;How do you output physical objects to the screen such as buttons and hyperlinks?

Thanks

Cammy</description>
		<content:encoded><![CDATA[<p>I have been getting on well with the tutorials and have learnt a lot. I was just wondering if they cover proper OOP because, as yet, there has been none and with only a few more lessons til the end, I am getting worried that it will not be covered. For example, &#8220;How do you output physical objects to the screen such as buttons and hyperlinks?</p>
<p>Thanks</p>
<p>Cammy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashish aec</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-32435</link>
		<dc:creator>ashish aec</dc:creator>
		<pubDate>Wed, 19 Nov 2008 08:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-32435</guid>
		<description>This is the exmple of multiple inheritance.
in which class a is base class and class b and c is drived class .
the base class a is publicly inherit by drive class b and c.
should read with 100% efficency.
thanks.</description>
		<content:encoded><![CDATA[<p>This is the exmple of multiple inheritance.<br />
in which class a is base class and class b and c is drived class .<br />
the base class a is publicly inherit by drive class b and c.<br />
should read with 100% efficency.<br />
thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gswrg</title>
		<link>http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/comment-page-1/#comment-30550</link>
		<dc:creator>gswrg</dc:creator>
		<pubDate>Wed, 22 Oct 2008 10:28:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/114-constructors-and-initialization-of-derived-classes/#comment-30550</guid>
		<description>In this example, class C is derived from class B, which is derived from class C

should read

In this example, class C is derived from class B, which is derived from class A

[ Fixed!  Thank you.  -Alex ]</description>
		<content:encoded><![CDATA[<p>In this example, class C is derived from class B, which is derived from class C</p>
<p>should read</p>
<p>In this example, class C is derived from class B, which is derived from class A</p>
<p>[ Fixed!  Thank you.  -Alex ]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

