<?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[Stringkostante in Interface]]></title><description><![CDATA[<p>Wie kann man eine Stringkostante in einer Interfaceklasse initialisieren?</p>
<pre><code>class IFoo
{
public:
   static const std::string txt(&quot;abc&quot;); //geht nicht
   virtual int bar() = 0;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/324590/stringkostante-in-interface</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 10:52:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/324590.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Mar 2014 15:50:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 15:50:26 GMT]]></title><description><![CDATA[<p>Wie kann man eine Stringkostante in einer Interfaceklasse initialisieren?</p>
<pre><code>class IFoo
{
public:
   static const std::string txt(&quot;abc&quot;); //geht nicht
   virtual int bar() = 0;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2390591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390591</guid><dc:creator><![CDATA[albertoerlber]]></dc:creator><pubDate>Sun, 23 Mar 2014 15:50:26 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 15:54:10 GMT]]></title><description><![CDATA[<p>albertoerlber schrieb:</p>
<blockquote>
<p>Interfaceklasse</p>
</blockquote>
<p>Was ist eine Interfaceklasse?</p>
<p>Btw: Es geht, du verwendest nur eine alte Version von C++ (vor C++11).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2390593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390593</guid><dc:creator><![CDATA[purec++]]></dc:creator><pubDate>Sun, 23 Mar 2014 15:54:10 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 16:12:00 GMT]]></title><description><![CDATA[<p><a href="http://ideone.com/6nz4Ix" rel="nofollow">http://ideone.com/6nz4Ix</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2390597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390597</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 23 Mar 2014 16:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 16:19:22 GMT]]></title><description><![CDATA[<pre><code>class IFoo
{
public:
   static const std::string txt; 
   virtual int bar() = 0;
};

const std::string IFoo::txt(&quot;abc&quot;);
</code></pre>
<p>Vor C++11 mussten statische Member außerhalb der Klasse definiert werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2390598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390598</guid><dc:creator><![CDATA[mortified_penguin]]></dc:creator><pubDate>Sun, 23 Mar 2014 16:19:22 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 16:20:57 GMT]]></title><description><![CDATA[<p>mortified_penguin schrieb:</p>
<blockquote>
<p>Vor C++11 mussten statische Member außerhalb der Klasse definiert werden.</p>
</blockquote>
<p>Nathan schrieb:</p>
<blockquote>
<p><a href="http://ideone.com/6nz4Ix" rel="nofollow">http://ideone.com/6nz4Ix</a></p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2390599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390599</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 23 Mar 2014 16:20:57 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 16:26:28 GMT]]></title><description><![CDATA[<p>Worauf willst du hinaus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2390601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390601</guid><dc:creator><![CDATA[mortified_penguin]]></dc:creator><pubDate>Sun, 23 Mar 2014 16:26:28 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 16:47:41 GMT]]></title><description><![CDATA[<p>mortified_penguin schrieb:</p>
<blockquote>
<p>Worauf willst du hinaus?</p>
</blockquote>
<p>Laut ideone auch mit C++11.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2390609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390609</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 23 Mar 2014 16:47:41 GMT</pubDate></item><item><title><![CDATA[Reply to Stringkostante in Interface on Sun, 23 Mar 2014 17:41:29 GMT]]></title><description><![CDATA[<p>Es war schon immer so, dass man statische Member in der Klasse nur deklariert.</p>
<p>Falls der std::string sowieso konstant bleibt, warum dann nicht einfach</p>
<pre><code>static char constexpr txt[] = &quot;abc&quot;;
</code></pre>
<p>?<br />
So kann man das in der Klasse initialisieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2390630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2390630</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sun, 23 Mar 2014 17:41:29 GMT</pubDate></item></channel></rss>