<?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[Klassen mit Prototypen]]></title><description><![CDATA[<p>Ich bin noch Anfänger in C++ und versuche mich gerade an OOP. Dabei bin ich auf folgendes Problem gestoßen:</p>
<pre><code class="language-cpp">class CSohn
{
	private:
		CVater* m_pVater;

	public:
		void SetVater( CVater* pVater )
		{
			m_pVater = pVater;
		}
};

class CVater
{
	private:
		CSohn* m_pSohn;

	public:
		void SetSohn( CSohn* pSohn )
		{
			m_pSohn = pSohn;
		}
};
</code></pre>
<p>In CVater wird CSohn verwendet und umgekehrt. Es bringt also nix, eine Klasse vor der anderen zu definieren.<br />
Meine Frage: Gibt es sowas wie Prototypen für Klassen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/201223/klassen-mit-prototypen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 17:49:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/201223.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Dec 2007 18:11:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Klassen mit Prototypen on Wed, 26 Dec 2007 18:11:59 GMT]]></title><description><![CDATA[<p>Ich bin noch Anfänger in C++ und versuche mich gerade an OOP. Dabei bin ich auf folgendes Problem gestoßen:</p>
<pre><code class="language-cpp">class CSohn
{
	private:
		CVater* m_pVater;

	public:
		void SetVater( CVater* pVater )
		{
			m_pVater = pVater;
		}
};

class CVater
{
	private:
		CSohn* m_pSohn;

	public:
		void SetSohn( CSohn* pSohn )
		{
			m_pSohn = pSohn;
		}
};
</code></pre>
<p>In CVater wird CSohn verwendet und umgekehrt. Es bringt also nix, eine Klasse vor der anderen zu definieren.<br />
Meine Frage: Gibt es sowas wie Prototypen für Klassen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426393</guid><dc:creator><![CDATA[Oopy]]></dc:creator><pubDate>Wed, 26 Dec 2007 18:11:59 GMT</pubDate></item><item><title><![CDATA[Reply to Klassen mit Prototypen on Wed, 26 Dec 2007 18:29:51 GMT]]></title><description><![CDATA[<p>Ich bin mir nicht sicher, was Du mit &quot;Prototyp&quot; meinst. Prototyp hat in der OOP eine ganz spezielle Bedeutung, die Du mit großer Wahrscheinlichkeit nicht meinst. Also, was willst Du umsetzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426397</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426397</guid><dc:creator><![CDATA[*john 0]]></dc:creator><pubDate>Wed, 26 Dec 2007 18:29:51 GMT</pubDate></item><item><title><![CDATA[Reply to Klassen mit Prototypen on Wed, 26 Dec 2007 18:36:57 GMT]]></title><description><![CDATA[<p>Bei Funktionen kann ich ja einen Prototyp definieren, und sie dann verwenden, bevor ich schreibe, was sie machen soll:</p>
<pre><code class="language-cpp">void TuWas( );

for( int i=0; i&lt;10; i++ )
{
	TuWas( );
}

void TuWas( )
{
	// Und hier stehen erst die Anweisungen ...
}
</code></pre>
<p>Mein Problem ist, dass ich oben CVater in der Klasse CSohn verwende, obwohl CVater noch nicht definiert ist. Ich könnte jetzt zwar zuerst CVater definieren, doch diese Klasse verwendet wiederum CSohn, welcher dann unbekannt wäre.</p>
<p>Verstanden, was ich meine? Ich hoffe, jemand kann mir helfen. :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426399</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426399</guid><dc:creator><![CDATA[Oopy]]></dc:creator><pubDate>Wed, 26 Dec 2007 18:36:57 GMT</pubDate></item><item><title><![CDATA[Reply to Klassen mit Prototypen on Wed, 26 Dec 2007 18:39:48 GMT]]></title><description><![CDATA[<p>Forward-Deklarationen?</p>
<pre><code class="language-cpp">class CVater;

class CSohn 
{ 
    private: 
        CVater* m_pVater; 

    public: 
        void SetVater( CVater* pVater ) 
        { 
            m_pVater = pVater; 
        } 
}; 

class CVater 
{ 
    private: 
        CSohn* m_pSohn; 

    public: 
        void SetSohn( CSohn* pSohn ) 
        { 
            m_pSohn = pSohn; 
        } 
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1426404</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426404</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Wed, 26 Dec 2007 18:39:48 GMT</pubDate></item><item><title><![CDATA[Reply to Klassen mit Prototypen on Wed, 26 Dec 2007 18:57:25 GMT]]></title><description><![CDATA[<p>Ha, dankeschön. Genau das, was ich brauche. :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426417</guid><dc:creator><![CDATA[Oopy]]></dc:creator><pubDate>Wed, 26 Dec 2007 18:57:25 GMT</pubDate></item><item><title><![CDATA[Reply to Klassen mit Prototypen on Wed, 26 Dec 2007 19:29:59 GMT]]></title><description><![CDATA[<p>void SetSohn( CSohn* pSohn )<br />
{<br />
m_pSohn = pSohn;<br />
}</p>
<p>meinst du wohl <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426426</guid><dc:creator><![CDATA[^^]]></dc:creator><pubDate>Wed, 26 Dec 2007 19:29:59 GMT</pubDate></item></channel></rss>