<?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[enum mit komplexen Informationen]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>da ich aus dem Java-Bereich komme, bin ich es gewohnt enums<br />
auch mit komplexeren Informationen (mehr als ein int) zu erstellen.</p>
<p>Wie würde man so etwas in C++ am elegantesten implementieren?</p>
<pre><code class="language-java">public enum MyEnum {
	Foo(1, 'a'), Bar(4, 'c'), FooBar(14, 'd');

	private int i;
	private char c; 

	private MyEnum(int i, char c){
		this.i = c;
	}

	public int getI() {
		return i;
	}

	public char getC() {
		return c;
	}

}
</code></pre>
<p>Viele Konstanten und einen Vektor/array, der Zeiger darauf hält?</p>
<p>Danke im Voraus,<br />
Marco21</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/282244/enum-mit-komplexen-informationen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 08:06:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/282244.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Feb 2011 14:50:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to enum mit komplexen Informationen on Wed, 16 Feb 2011 14:50:06 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>da ich aus dem Java-Bereich komme, bin ich es gewohnt enums<br />
auch mit komplexeren Informationen (mehr als ein int) zu erstellen.</p>
<p>Wie würde man so etwas in C++ am elegantesten implementieren?</p>
<pre><code class="language-java">public enum MyEnum {
	Foo(1, 'a'), Bar(4, 'c'), FooBar(14, 'd');

	private int i;
	private char c; 

	private MyEnum(int i, char c){
		this.i = c;
	}

	public int getI() {
		return i;
	}

	public char getC() {
		return c;
	}

}
</code></pre>
<p>Viele Konstanten und einen Vektor/array, der Zeiger darauf hält?</p>
<p>Danke im Voraus,<br />
Marco21</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021844</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021844</guid><dc:creator><![CDATA[Marco21]]></dc:creator><pubDate>Wed, 16 Feb 2011 14:50:06 GMT</pubDate></item><item><title><![CDATA[Reply to enum mit komplexen Informationen on Wed, 16 Feb 2011 14:56:25 GMT]]></title><description><![CDATA[<p>Könntest du eventuell darauf eingehen, was dein Beispiel da genau tut, bzw. wie man es verwenden kann? Vielleicht wissen hier auch einige erfahrene C++-Benutzer nicht viel damit anzufangen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021847</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 16 Feb 2011 14:56:25 GMT</pubDate></item><item><title><![CDATA[Reply to enum mit komplexen Informationen on Wed, 16 Feb 2011 15:00:23 GMT]]></title><description><![CDATA[<p>Oder noch besser: Erklär uns doch mal WAS und nicht WIE du es tun willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021852</guid><dc:creator><![CDATA[rean]]></dc:creator><pubDate>Wed, 16 Feb 2011 15:00:23 GMT</pubDate></item></channel></rss>