<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fehler Hilfe]]></title><description><![CDATA[<p>Programm</p>
<p>KFZ.h</p>
<pre><code>#ifndef KFZ_H
#define KFZ_H
#include &quot;LKW.h&quot;
#include &lt;iostream&gt;

class KFZ
{
    public:

    // Konstruktor

    KFZ(char* nModellname, char* Typ, int nTankgr,double nVerbrauch100Km,double nTankinhalt,double nKmStand,double nGewicht);

	// Alles Zeigen

    void Show();

	// Attribute

    private:

	char* Hersteller;
	char* Typ;
    int Tankgr;
    double Verbrauch100Km;
    double Tankinhalt;
    double KmStand;
    double Gewicht;

};

#endif
</code></pre>
<p>LKW.h</p>
<pre><code>#ifndef LKW_H
#define LKW_H
#include &lt;iostream&gt;

class LKW
{
    public:

    // Konstruktor

    LKW(int nAnzahlAchsen,int nAnhaenger, double nlaengeMeter)
		:KFZ(nModellname, nTyp, nTankgr,nVerbrauch100Km,nTankinhalt,nKmStand,nGewicht);

	// Attribute

    private:

	int nAnzahlAchsen;
	int nAnhaenger;
	double nlaengeMeter;

};
#endif
</code></pre>
<p>KFZ.cpp</p>
<pre><code>using namespace std;

    KFZ::KFZ(char* nHersteller, char* nTyp,int nTankgr,double nVerbrauch100Km,double nTankinhalt,double nKmStand,double nGewicht):
    Hersteller(nHersteller),Typ(nTyp),Tankgr(nTankgr), Verbrauch100Km(nVerbrauch100Km), Tankinhalt(nTankinhalt), KmStand(nKmStand), Gewicht(nGewicht) {}

void KFZ::Show()
{
	cout&lt;&lt; &quot;Hersteller : &quot;&lt;&lt; Hersteller&lt;&lt;endl;
	cout&lt;&lt; &quot;Typ : &quot;&lt;&lt; Typ&lt;&lt;endl;
    cout&lt;&lt; &quot;Tankgroeße : &quot;&lt;&lt; Tankgr &lt;&lt;endl;
    cout&lt;&lt; &quot;Verbrauch auf 100 Km : &quot;&lt;&lt; Verbrauch100Km &lt;&lt;endl;
    cout&lt;&lt; &quot;Tankinhalt zurzeit : &quot;&lt;&lt; Tankinhalt &lt;&lt;endl;
    cout&lt;&lt; &quot;Aktueller Km Stand : &quot;&lt;&lt; KmStand &lt;&lt;endl;
    cout&lt;&lt; &quot;Zulässiges Gewicht : &quot;&lt;&lt; Gewicht &lt;&lt;endl;

}
</code></pre>
<p>LKW.cpp</p>
<pre><code>#include &lt;iostream&gt;
#include &quot;LKW.h&quot;

LKW::LKW(int nAnzahlAchsen,int nAnhaenger, double nlaengeMeter):
AnzahlAchsen(nAnzahlAchsen),Anhaenger(nAnhaenger),LaengeMeter(nlaengeMeter)
:KFZ(nModellname, nTyp, nTankgr,nVerbrauch100Km,nTankinhalt,nKmStand,nGewicht){}
</code></pre>
<p>main.cpp</p>
<pre><code>#include &lt;iostream&gt;
#include &quot;KFZ.h&quot;

using namespace std;

int main()
{

    KFZ Audi(&quot;Audi&quot;,&quot;R8&quot;,50,16.8,30.5,100000,1.0);

	LKW Mercedes(2,1,35.5,&quot;Audi&quot;,&quot;R8&quot;,50,16.8,30.5,100000,1.0);

    Audi.Show();
	Mercedes.Show();

	system(&quot;pause&quot;);
    return 0;
}
</code></pre>
<p>Problem: Ich glaube ich verstehe die ganze Vererbung und Konstruktoren nicht so richtig.</p>
<p>Fehler....<br />
In der LKW.h sagt er mir das nModellname nicht definiert ist. Und KFZ wäre keine statische Basisklasse.</p>
<p>In der Main.cpp ist die Funktion show zu Mercedes nicht möglich.<br />
und die LKW Mercedes(2 wäre keine Instanz des Konstruktors...</p>
<p>Die Lkw.cpp ist wohl totaler schrott...</p>
<p>kann mir jemand sinnvoll únd einfach meine Fehler erklären und begründen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/313280/fehler-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Sun, 02 Aug 2026 08:35:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/313280.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Jan 2013 13:00:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehler Hilfe on Sat, 26 Jan 2013 13:00:07 GMT]]></title><description><![CDATA[<p>Programm</p>
<p>KFZ.h</p>
<pre><code>#ifndef KFZ_H
#define KFZ_H
#include &quot;LKW.h&quot;
#include &lt;iostream&gt;

class KFZ
{
    public:

    // Konstruktor

    KFZ(char* nModellname, char* Typ, int nTankgr,double nVerbrauch100Km,double nTankinhalt,double nKmStand,double nGewicht);

	// Alles Zeigen

    void Show();

	// Attribute

    private:

	char* Hersteller;
	char* Typ;
    int Tankgr;
    double Verbrauch100Km;
    double Tankinhalt;
    double KmStand;
    double Gewicht;

};

#endif
</code></pre>
<p>LKW.h</p>
<pre><code>#ifndef LKW_H
#define LKW_H
#include &lt;iostream&gt;

class LKW
{
    public:

    // Konstruktor

    LKW(int nAnzahlAchsen,int nAnhaenger, double nlaengeMeter)
		:KFZ(nModellname, nTyp, nTankgr,nVerbrauch100Km,nTankinhalt,nKmStand,nGewicht);

	// Attribute

    private:

	int nAnzahlAchsen;
	int nAnhaenger;
	double nlaengeMeter;

};
#endif
</code></pre>
<p>KFZ.cpp</p>
<pre><code>using namespace std;

    KFZ::KFZ(char* nHersteller, char* nTyp,int nTankgr,double nVerbrauch100Km,double nTankinhalt,double nKmStand,double nGewicht):
    Hersteller(nHersteller),Typ(nTyp),Tankgr(nTankgr), Verbrauch100Km(nVerbrauch100Km), Tankinhalt(nTankinhalt), KmStand(nKmStand), Gewicht(nGewicht) {}

void KFZ::Show()
{
	cout&lt;&lt; &quot;Hersteller : &quot;&lt;&lt; Hersteller&lt;&lt;endl;
	cout&lt;&lt; &quot;Typ : &quot;&lt;&lt; Typ&lt;&lt;endl;
    cout&lt;&lt; &quot;Tankgroeße : &quot;&lt;&lt; Tankgr &lt;&lt;endl;
    cout&lt;&lt; &quot;Verbrauch auf 100 Km : &quot;&lt;&lt; Verbrauch100Km &lt;&lt;endl;
    cout&lt;&lt; &quot;Tankinhalt zurzeit : &quot;&lt;&lt; Tankinhalt &lt;&lt;endl;
    cout&lt;&lt; &quot;Aktueller Km Stand : &quot;&lt;&lt; KmStand &lt;&lt;endl;
    cout&lt;&lt; &quot;Zulässiges Gewicht : &quot;&lt;&lt; Gewicht &lt;&lt;endl;

}
</code></pre>
<p>LKW.cpp</p>
<pre><code>#include &lt;iostream&gt;
#include &quot;LKW.h&quot;

LKW::LKW(int nAnzahlAchsen,int nAnhaenger, double nlaengeMeter):
AnzahlAchsen(nAnzahlAchsen),Anhaenger(nAnhaenger),LaengeMeter(nlaengeMeter)
:KFZ(nModellname, nTyp, nTankgr,nVerbrauch100Km,nTankinhalt,nKmStand,nGewicht){}
</code></pre>
<p>main.cpp</p>
<pre><code>#include &lt;iostream&gt;
#include &quot;KFZ.h&quot;

using namespace std;

int main()
{

    KFZ Audi(&quot;Audi&quot;,&quot;R8&quot;,50,16.8,30.5,100000,1.0);

	LKW Mercedes(2,1,35.5,&quot;Audi&quot;,&quot;R8&quot;,50,16.8,30.5,100000,1.0);

    Audi.Show();
	Mercedes.Show();

	system(&quot;pause&quot;);
    return 0;
}
</code></pre>
<p>Problem: Ich glaube ich verstehe die ganze Vererbung und Konstruktoren nicht so richtig.</p>
<p>Fehler....<br />
In der LKW.h sagt er mir das nModellname nicht definiert ist. Und KFZ wäre keine statische Basisklasse.</p>
<p>In der Main.cpp ist die Funktion show zu Mercedes nicht möglich.<br />
und die LKW Mercedes(2 wäre keine Instanz des Konstruktors...</p>
<p>Die Lkw.cpp ist wohl totaler schrott...</p>
<p>kann mir jemand sinnvoll únd einfach meine Fehler erklären und begründen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2293600</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2293600</guid><dc:creator><![CDATA[nick88]]></dc:creator><pubDate>Sat, 26 Jan 2013 13:00:07 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler Hilfe on Sat, 26 Jan 2013 13:19:25 GMT]]></title><description><![CDATA[<p>in der LKW.h habe ich bereits KFZ.h include....<br />
und eben auch die klasse class LKW: public KFZ vererbt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2293603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2293603</guid><dc:creator><![CDATA[nick88]]></dc:creator><pubDate>Sat, 26 Jan 2013 13:19:25 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler Hilfe on Sat, 26 Jan 2013 13:24:02 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/313240" rel="nofollow">http://www.c-plusplus.net/forum/313240</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2293604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2293604</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sat, 26 Jan 2013 13:24:02 GMT</pubDate></item></channel></rss>