<?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[Initialisator schlägt fehl]]></title><description><![CDATA[<p>hi,</p>
<p>ich hab ein Problem mit meinem Initialisator von meiner Klasse Zahl:</p>
<pre><code class="language-cpp">class Zahl {
	private:
		int Wert;
		bool Prim;
	public:
		Zahl (int, bool);
};

Zahl::Zahl (int i, bool b);
{
	Wert = i;
	Prim = b;
}
</code></pre>
<p>Mehr Code hab ich noch nicht geschrieben. Nur eine Test-Klasse hab ich initialisiert. Trotzdem bekomme ich folgenden Fehler:</p>
<pre><code>In file included from prim.cpp:1:
zahl.hpp:9: error: declaration of `Zahl::Zahl(int, bool)' outside of class is 
   not definition
zahl.hpp:10: error: parse error before `{' token
zahl.hpp:12: error: ISO C++ forbids declaration of `Prim' with no type
zahl.hpp:12: error: `b' was not declared in this scope
zahl.hpp:13: error: parse error before `}' token
</code></pre>
<p>Was soll das heißen?</p>
<p>Vielen Dank im vorraus</p>
<p>Joachim</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/133136/initialisator-schlägt-fehl</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 18:48:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/133136.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Jan 2006 15:29:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Initialisator schlägt fehl on Sun, 15 Jan 2006 15:29:02 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>ich hab ein Problem mit meinem Initialisator von meiner Klasse Zahl:</p>
<pre><code class="language-cpp">class Zahl {
	private:
		int Wert;
		bool Prim;
	public:
		Zahl (int, bool);
};

Zahl::Zahl (int i, bool b);
{
	Wert = i;
	Prim = b;
}
</code></pre>
<p>Mehr Code hab ich noch nicht geschrieben. Nur eine Test-Klasse hab ich initialisiert. Trotzdem bekomme ich folgenden Fehler:</p>
<pre><code>In file included from prim.cpp:1:
zahl.hpp:9: error: declaration of `Zahl::Zahl(int, bool)' outside of class is 
   not definition
zahl.hpp:10: error: parse error before `{' token
zahl.hpp:12: error: ISO C++ forbids declaration of `Prim' with no type
zahl.hpp:12: error: `b' was not declared in this scope
zahl.hpp:13: error: parse error before `}' token
</code></pre>
<p>Was soll das heißen?</p>
<p>Vielen Dank im vorraus</p>
<p>Joachim</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967190</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967190</guid><dc:creator><![CDATA[j0achim]]></dc:creator><pubDate>Sun, 15 Jan 2006 15:29:02 GMT</pubDate></item><item><title><![CDATA[Reply to Initialisator schlägt fehl on Sun, 15 Jan 2006 15:50:23 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">class Zahl {
    private:
        int Wert;
        bool Prim;
    public:
        Zahl (int, bool);
};

Zahl::Zahl (int i, bool b);
{
    Wert = i;
    Prim = b;
}
</code></pre>
<p>Mach das Semikolon nach folgender Zeile weg:</p>
<pre><code class="language-cpp">Zahl::Zahl (int i, bool b)
</code></pre>
<p>und nutz Parameterlisten:</p>
<pre><code class="language-cpp">Zahl::Zahl: Wert(i), Prim(b)
{
}
</code></pre>
<p>Hoffe, dass das so klappt.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967230</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 15 Jan 2006 15:50:23 GMT</pubDate></item></channel></rss>