<?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[Array von Klassen übergeben]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich hab folgendes (einfaches) Problem:</p>
<p>Ich möchte von proceed (eine Funktion der Klasse level)<br />
auf das ganze Feld von Block bl zugreifen können<br />
aber ich weiss nicht wie ich referenzieren soll.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

class block
{
      public:
      int x;
      int y;

      block()
      {
           x=0;y=0;
      }

};

class level
{
      public:

      void proceed(block&amp; tb)
      {

           cout &lt;&lt; tb[3].x;
      }
};

int main(int argc, char **argv)
{

    block bl[10];
    level lvl;
    bl[3].x=3;
    bl[7].y=7;

    lvl.proceed(bl); 
    // proceed soll jetzt x von bl[3] 
    // und y von bl[7] ausgeben
    // d.h. ich brauch unbedingt vollen zugriff auf alle elemente von bl in proceed

    return 0;
}
</code></pre>
<p>mingw32 gibt mir nur fehlermeldungen, was mache ich falsch?<br />
Kann mir jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/132067/array-von-klassen-übergeben</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 10:56:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/132067.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 07 Jan 2006 22:17:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Array von Klassen übergeben on Sat, 07 Jan 2006 22:17:38 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich hab folgendes (einfaches) Problem:</p>
<p>Ich möchte von proceed (eine Funktion der Klasse level)<br />
auf das ganze Feld von Block bl zugreifen können<br />
aber ich weiss nicht wie ich referenzieren soll.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

class block
{
      public:
      int x;
      int y;

      block()
      {
           x=0;y=0;
      }

};

class level
{
      public:

      void proceed(block&amp; tb)
      {

           cout &lt;&lt; tb[3].x;
      }
};

int main(int argc, char **argv)
{

    block bl[10];
    level lvl;
    bl[3].x=3;
    bl[7].y=7;

    lvl.proceed(bl); 
    // proceed soll jetzt x von bl[3] 
    // und y von bl[7] ausgeben
    // d.h. ich brauch unbedingt vollen zugriff auf alle elemente von bl in proceed

    return 0;
}
</code></pre>
<p>mingw32 gibt mir nur fehlermeldungen, was mache ich falsch?<br />
Kann mir jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/960259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/960259</guid><dc:creator><![CDATA[traceman]]></dc:creator><pubDate>Sat, 07 Jan 2006 22:17:38 GMT</pubDate></item><item><title><![CDATA[Reply to Array von Klassen übergeben on Sat, 07 Jan 2006 22:35:00 GMT]]></title><description><![CDATA[<p>hey,<br />
..zu dem code an sich werden bestimmt gleich noch genug Leute was sagen, aber nun gut...<br />
tip: probiere es mal mit<br />
void proceed(block* tb)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/960271</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/960271</guid><dc:creator><![CDATA[freshman]]></dc:creator><pubDate>Sat, 07 Jan 2006 22:35:00 GMT</pubDate></item><item><title><![CDATA[Reply to Array von Klassen übergeben on Sat, 07 Jan 2006 23:23:02 GMT]]></title><description><![CDATA[<p>Ich habe es auf block* bl geändert (auch in main)<br />
Nun stellt sich die Frage wie ich denn nun einen Wert zuweise.<br />
Eigentlich müsste ich doch durch 3maliges inkrementieren des bl array<br />
und anschliessender Zuweisung per bl-&gt;x=3 Erfolg haben wenn wir bei dem<br />
Beispiel bleiben. Aber der Compiler wehrt sich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/960301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/960301</guid><dc:creator><![CDATA[traceman]]></dc:creator><pubDate>Sat, 07 Jan 2006 23:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to Array von Klassen übergeben on Sun, 08 Jan 2006 07:55:10 GMT]]></title><description><![CDATA[<p>traceman schrieb:</p>
<blockquote>
<p>Ich ... (auch in main)...</p>
</blockquote>
<p>Wieso das?<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-124532.html" rel="nofollow">Lesen</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/960382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/960382</guid><dc:creator><![CDATA[TeeGehGehZeh]]></dc:creator><pubDate>Sun, 08 Jan 2006 07:55:10 GMT</pubDate></item><item><title><![CDATA[Reply to Array von Klassen übergeben on Sun, 08 Jan 2006 11:51:24 GMT]]></title><description><![CDATA[<p>Beim ersten Versuch (ohne die Änderung in main) ist der Rechner abgestürzt. Nun<br />
geht alles. Lag wohl daran das ich nicht alles neu erstellt habe.</p>
<p>Vielen Dank nochmals!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/960459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/960459</guid><dc:creator><![CDATA[traceman]]></dc:creator><pubDate>Sun, 08 Jan 2006 11:51:24 GMT</pubDate></item></channel></rss>