<?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[Problem beim Vererben einer Klasse]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich bin vor kurzem von Delphi auf c++ umgestiegen und habe jetzt ein Problem: Ich habe eine Klasse von der ich eine andere ableite. Bei der Abgeleiteten aber möchte der Compiler anscheinend den Constructor nicht akzeptieren, zumindest bekomme ich den Fehler:<br />
error C2226: syntax error : unexpected type 'std::string'</p>
<pre><code>#include &lt;string&gt;

class CPrlException
{
public:
	CPrlException(const std::string &amp;strFile, unsigned int nLine, const std::string &amp;strError);
	void DisplayMessageBox();
	void WriteToLog();
	virtual void GenerateText();  // m_strError evtl. verändern
	std::string m_strError, m_strFile;
	unsigned int m_nLine;
};

class CPrlHrException: CPrlException
{
public:
	CPrlHrException(const std::string &amp;strFile, unsigned int nLine, const std::string &amp;strError, const HRESULT hr); // FEHLER
};
</code></pre>
<p>Vielen Dank schonmal</p>
<p>Pearly</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/175377/problem-beim-vererben-einer-klasse</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 03:06:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/175377.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Mar 2007 17:53:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Fri, 09 Mar 2007 17:53:45 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich bin vor kurzem von Delphi auf c++ umgestiegen und habe jetzt ein Problem: Ich habe eine Klasse von der ich eine andere ableite. Bei der Abgeleiteten aber möchte der Compiler anscheinend den Constructor nicht akzeptieren, zumindest bekomme ich den Fehler:<br />
error C2226: syntax error : unexpected type 'std::string'</p>
<pre><code>#include &lt;string&gt;

class CPrlException
{
public:
	CPrlException(const std::string &amp;strFile, unsigned int nLine, const std::string &amp;strError);
	void DisplayMessageBox();
	void WriteToLog();
	virtual void GenerateText();  // m_strError evtl. verändern
	std::string m_strError, m_strFile;
	unsigned int m_nLine;
};

class CPrlHrException: CPrlException
{
public:
	CPrlHrException(const std::string &amp;strFile, unsigned int nLine, const std::string &amp;strError, const HRESULT hr); // FEHLER
};
</code></pre>
<p>Vielen Dank schonmal</p>
<p>Pearly</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242471</guid><dc:creator><![CDATA[Pearly]]></dc:creator><pubDate>Fri, 09 Mar 2007 17:53:45 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Fri, 09 Mar 2007 18:20:43 GMT]]></title><description><![CDATA[<p>Probier mal, obs geht wenn du aus</p>
<pre><code class="language-cpp">class CPrlHrException: CPrlException
</code></pre>
<pre><code class="language-cpp">class CPrlHrException: public CPrlException
</code></pre>
<p>machst.<br />
Kann sein, dass da nochwas falsch ist, aber das muss jedenfalls geändert werden.<br />
Mit dem &quot;public&quot; gibst du an, dass</p>
<ul>
<li>public-Elemente der Basisklasse auch in der abgeleiteten Klasse public sind</li>
<li>protected-Elemente der Basisklasse auch in der abgeleiteten Klasse protected sind</li>
</ul>
<p>Alternativ hast du zwei Möglichkeiten:</p>
<ul>
<li>protected: public --&gt; protected, protected --&gt; protected</li>
<li>private: public --&gt; private, protected --&gt; private</li>
</ul>
]]></description><link>https://www.c-plusplus.net/forum/post/1242482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242482</guid><dc:creator><![CDATA[Sinthoras]]></dc:creator><pubDate>Fri, 09 Mar 2007 18:20:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Fri, 09 Mar 2007 19:16:47 GMT]]></title><description><![CDATA[<p>Hmm hat leider nichts verändert aber troztdem thx</p>
<p>Pearly</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242532</guid><dc:creator><![CDATA[Pearly]]></dc:creator><pubDate>Fri, 09 Mar 2007 19:16:47 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Fri, 09 Mar 2007 19:19:36 GMT]]></title><description><![CDATA[<p>Sind beide Klassen in der gleichen Datei und sieht diese genau so aus wie in deinem ersten Beitrag gepostet?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242533</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242533</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Fri, 09 Mar 2007 19:19:36 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Fri, 09 Mar 2007 22:42:11 GMT]]></title><description><![CDATA[<p>Anders gesagt: Der gepostete Code ist korrekt, der Fehler liegt woanders <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242664</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Fri, 09 Mar 2007 22:42:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Sat, 10 Mar 2007 08:31:08 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ja, wenn ich alles rausnehme was ich nicht gepostet hatte (#ifndef etc., ein #include), kommt der Fehler nach wie vor. Dass es sich um einen Constructor handelt scheint der Compiler doch zu erkennen, dass steht da nämlich wenn ich vor ihm ein int setze. (constructor with return type)<br />
Abgesehen von dem Syntax Error kommen übrigens noch</p>
<p>error C2238: unexpected token(s) preceding ';'<br />
(in der selben Zeile) und</p>
<p>error C2511: 'CPrlHrException::CPrlHrException(const std::string &amp;,unsigned int,const std::string &amp;,const HRESULT)' : overloaded member function not found in 'CPrlHrException'<br />
bei der Implementierung des Constructors</p>
<p>Pearly</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242723</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242723</guid><dc:creator><![CDATA[Pearly]]></dc:creator><pubDate>Sat, 10 Mar 2007 08:31:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Sat, 10 Mar 2007 09:13:02 GMT]]></title><description><![CDATA[<p>Pearly schrieb:</p>
<blockquote>
<p>Ja, wenn ich alles rausnehme was ich nicht gepostet hatte (#ifndef etc., ein #include), kommt der Fehler nach wie vor.</p>
</blockquote>
<p>Das hilft aber nicht weiter. In dem gezeigten Code ist kein Fehler (wenn man von der fehlenden Definition des Typen HRESULT mal absieht, irgendjemand wird halt windows.h einbinden). Möglicherweise steckt er in einem Header, der davor eingebunden wird. Zeig ein vollständiges Beispiel, das den Fehler reproduziert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242734</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 10 Mar 2007 09:13:02 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Sat, 10 Mar 2007 09:30:18 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/2803">@MFK</a>:<br />
ich denke, es ist die fehlende &quot;windows.h&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242735</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242735</guid><dc:creator><![CDATA[elise]]></dc:creator><pubDate>Sat, 10 Mar 2007 09:30:18 GMT</pubDate></item><item><title><![CDATA[Reply to Problem beim Vererben einer Klasse on Sat, 10 Mar 2007 09:44:50 GMT]]></title><description><![CDATA[<p>Ja, es funktioniert jetzt! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Danke für die schnelle Hilfe!</p>
<p>Pearly</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242738</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242738</guid><dc:creator><![CDATA[Pearly]]></dc:creator><pubDate>Sat, 10 Mar 2007 09:44:50 GMT</pubDate></item></channel></rss>