<?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[Felder von Objecten dynamische erweitern]]></title><description><![CDATA[<p>Hallo</p>
<p>Hab schon in der Suche nachgeschaut, habe aber nichts gefunden.</p>
<p>Folgendes Problem:<br />
Ich habe ein Array von Objecten einer bestimmten Klasse. Ist es nun möglich eizelne Felder dynamisch hinzuzufügen, sprich aus einem [5]er Array ein [6]er zu machen?</p>
<p>Falls das nicht gehen sollte, gibt´s alternativen?</p>
<p>Danke schonmal im vorraus für jede Antwort.</p>
<p>Gruß<br />
Björn</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/57198/felder-von-objecten-dynamische-erweitern</link><generator>RSS for Node</generator><lastBuildDate>Tue, 02 Jun 2026 12:06:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/57198.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Dec 2003 17:26:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Felder von Objecten dynamische erweitern on Tue, 02 Dec 2003 17:26:57 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Hab schon in der Suche nachgeschaut, habe aber nichts gefunden.</p>
<p>Folgendes Problem:<br />
Ich habe ein Array von Objecten einer bestimmten Klasse. Ist es nun möglich eizelne Felder dynamisch hinzuzufügen, sprich aus einem [5]er Array ein [6]er zu machen?</p>
<p>Falls das nicht gehen sollte, gibt´s alternativen?</p>
<p>Danke schonmal im vorraus für jede Antwort.</p>
<p>Gruß<br />
Björn</p>
]]></description><link>https://www.c-plusplus.net/forum/post/406666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/406666</guid><dc:creator><![CDATA[Björn2]]></dc:creator><pubDate>Tue, 02 Dec 2003 17:26:57 GMT</pubDate></item><item><title><![CDATA[Reply to Felder von Objecten dynamische erweitern on Tue, 02 Dec 2003 17:57:22 GMT]]></title><description><![CDATA[<p>CArray z.b.<br />
das ist aber ein array template. den typ muss man definieren.</p>
<p>z.b. CArray&lt;CMeineKlasse&gt;<br />
schau dir dazu beispiele in der msdn an.</p>
<p>würde aber selbst zu CObArray greifen.<br />
&quot;Ob&quot;, weil jede klasse auch unausdrücklich von CObject erbt.</p>
<pre><code class="language-cpp">// example for CObArray::Add

    CObArray array;

    array.Add( new CAge( 21 ) ); // Element 0
    array.Add( new CAge( 40 ) ); // Element 1
#ifdef _DEBUG
    afxDump.SetDepth( 1 );
    afxDump &lt;&lt; &quot;Add example: &quot; &lt;&lt; &amp;array &lt;&lt; &quot;\n&quot;;
#endif
The results from this program are as follows:

Add example: A CObArray with 2 elements
    [0] = a CAge at $442A 21
    [1] = a CAge at $4468 40

// example for CObArray::operator []

CObArray array;
CAge* pa;

array.Add( new CAge( 21 ) ); // Element 0
array.Add( new CAge( 40 ) ); // Element 1
pa = (CAge*)array[0]; // Get element 0
ASSERT( *pa == CAge( 21 ) ); // Get element 0
array[0] = new CAge( 30 ); // Replace element 0
delete pa;
ASSERT( *(CAge*) array[0] == CAge( 30 ) ); // Get new element 0
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/406695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/406695</guid><dc:creator><![CDATA[alex-t]]></dc:creator><pubDate>Tue, 02 Dec 2003 17:57:22 GMT</pubDate></item></channel></rss>