<?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[Attributliste und Wert von Attributen]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>stehe gerade vor folgenden Problemen:</p>
<p>1.Ich habe eine Methode list&lt;string&gt; attributliste(); Diese soll die Namen aller Attribute zurückgeben. Gibt es eine Möglichkeit die Attribute einer Liste abzufragen oder muss ich für jedes Attribut: listenname.push_back(attributname) aufrufen:</p>
<p>2.Eine 2te Methode string attrib(string:attribname) soll mir den Wert des attributes mit dem namen attribname zurückliefern, hab leider keinerlei Idee wie man soetwas realisiert.</p>
<p>Vielen Dank und Gruß</p>
<p>wuschel</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/165393/attributliste-und-wert-von-attributen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 13:26:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/165393.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Nov 2006 14:16:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 14:16:53 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>stehe gerade vor folgenden Problemen:</p>
<p>1.Ich habe eine Methode list&lt;string&gt; attributliste(); Diese soll die Namen aller Attribute zurückgeben. Gibt es eine Möglichkeit die Attribute einer Liste abzufragen oder muss ich für jedes Attribut: listenname.push_back(attributname) aufrufen:</p>
<p>2.Eine 2te Methode string attrib(string:attribname) soll mir den Wert des attributes mit dem namen attribname zurückliefern, hab leider keinerlei Idee wie man soetwas realisiert.</p>
<p>Vielen Dank und Gruß</p>
<p>wuschel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1177172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177172</guid><dc:creator><![CDATA[wuschel15]]></dc:creator><pubDate>Sun, 19 Nov 2006 14:16:53 GMT</pubDate></item><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 14:23:03 GMT]]></title><description><![CDATA[<p>was meinst du mit attributen? aus einer eigenen klasse? wie liegen sie dann vor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1177185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177185</guid><dc:creator><![CDATA[Cpt.Tanga]]></dc:creator><pubDate>Sun, 19 Nov 2006 14:23:03 GMT</pubDate></item><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 14:26:26 GMT]]></title><description><![CDATA[<p>ich habe eine Klasse z.b</p>
<p>class person{</p>
<p>private:</p>
<p>string _name;<br />
string _vorname;<br />
....usw.<br />
};</p>
<p>Jetzt würde ich gerne _name,_vorname usw. in die Attributliste aufnehmen.<br />
Dies möchte ich aber nicht für jede Klasse implementieren sondern in einer Oberklasse.</p>
<p>Gruß wuschel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1177188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177188</guid><dc:creator><![CDATA[wuschel15]]></dc:creator><pubDate>Sun, 19 Nov 2006 14:26:26 GMT</pubDate></item><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 15:07:40 GMT]]></title><description><![CDATA[<p>Nimm doch eine Map:</p>
<pre><code class="language-cpp">std::map&lt;std::string, std::string&gt; _attrList;
</code></pre>
<p>Dann hast du als Key alle Attributnamen und kannst intern einfach auf der Attributwerte zugreifen:</p>
<pre><code class="language-cpp">_attrList[&quot;Name&quot;] = &quot;Rudi&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1177192</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177192</guid><dc:creator><![CDATA[don_basto]]></dc:creator><pubDate>Sun, 19 Nov 2006 15:07:40 GMT</pubDate></item><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 14:52:50 GMT]]></title><description><![CDATA[<p>Dann hab ich ja immer noch das Problem, dass ich die Methode die die MAP füllt für jede Klasse definieren muss, so verringert sich ja nur die Anzahl der Methoden von 2 auf 1 oder?</p>
<p>Gruß wuschel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1177209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177209</guid><dc:creator><![CDATA[wuschel15]]></dc:creator><pubDate>Sun, 19 Nov 2006 14:52:50 GMT</pubDate></item><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 15:04:39 GMT]]></title><description><![CDATA[<p>Wie stellst du dir das denn vor?<br />
Da müsstest du schon mit dem Präprozessor tricksen oder ein kleines Tools schreiben, dass dir die Attributlisten erstellt und in die Klassen schreibt vorm Kompilieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1177214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177214</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Sun, 19 Nov 2006 15:04:39 GMT</pubDate></item><item><title><![CDATA[Reply to Attributliste und Wert von Attributen on Sun, 19 Nov 2006 15:25:28 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Fakt ist, das in C++ zur Laufzeit keine Variablennamen mehr bekannt sind.<br />
Es gibt also keine Möglichkeit, eine Liste aus den Attributsnamen und -wert zu erstellen.<br />
Sondern du must schon selber ein Konzept einbauen. Der Vorschlag mit der Map in Zusammenarbeit mit Polymorphie (wenn nötig) ist sinnvoll.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1177230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1177230</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 19 Nov 2006 15:25:28 GMT</pubDate></item></channel></rss>