<?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[String Klasse]]></title><description><![CDATA[<p>Hallo,<br />
kleine frage ich hänge gerade an einer Aufgabe, wie könnte ich so etwas</p>
<pre><code class="language-cpp">int main() {
String s1;
String s2(&quot;Vogelsang&quot;);
String s3(s2);
s1 += s2;
s2 = s3;
cout &lt;&lt; s2 &lt;&lt; endl;
cout &lt;&lt; s2[ 2 ] &lt;&lt; endl;
};
</code></pre>
<p>Implementieren ohne den string container zu nutzen also muss man hier eine eigene string klasse schreiben, konstruktor / werte speichern ist bereits getan aber wie kann ich zb cout &lt;&lt; s2 &lt;&lt; endl; realisieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/303491/string-klasse</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 11:08:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/303491.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 May 2012 14:49:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 14:49:16 GMT]]></title><description><![CDATA[<p>Hallo,<br />
kleine frage ich hänge gerade an einer Aufgabe, wie könnte ich so etwas</p>
<pre><code class="language-cpp">int main() {
String s1;
String s2(&quot;Vogelsang&quot;);
String s3(s2);
s1 += s2;
s2 = s3;
cout &lt;&lt; s2 &lt;&lt; endl;
cout &lt;&lt; s2[ 2 ] &lt;&lt; endl;
};
</code></pre>
<p>Implementieren ohne den string container zu nutzen also muss man hier eine eigene string klasse schreiben, konstruktor / werte speichern ist bereits getan aber wie kann ich zb cout &lt;&lt; s2 &lt;&lt; endl; realisieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2211781</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211781</guid><dc:creator><![CDATA[Weirdo]]></dc:creator><pubDate>Tue, 15 May 2012 14:49:16 GMT</pubDate></item><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 14:54:06 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out, String const&amp; str) {
  // Implementation der Ausgabe hier
  // (Ausgabe: out &lt;&lt; &quot;Zeichenkette&quot;. Genau so wie bei cout.)
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2211784</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211784</guid><dc:creator><![CDATA[pyhax]]></dc:creator><pubDate>Tue, 15 May 2012 14:54:06 GMT</pubDate></item><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 14:54:35 GMT]]></title><description><![CDATA[<p>Weirdo schrieb:</p>
<blockquote>
<p>wie kann ich zb cout &lt;&lt; s2 &lt;&lt; endl; realisieren?</p>
</blockquote>
<pre><code class="language-cpp">std::ostream&amp; operator &lt;&lt; (std::ostream&amp; stream, const my_string&amp; s)
{
  for (auto c : s)
    stream &lt;&lt; c;
  return stream;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2211787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211787</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Tue, 15 May 2012 14:54:35 GMT</pubDate></item><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 14:56:06 GMT]]></title><description><![CDATA[<p>*Edit<br />
Ich habe hier gerade Muell geschrieben weil ich deine Frage falsch gelesen habe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2211789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211789</guid><dc:creator><![CDATA[icarus2]]></dc:creator><pubDate>Tue, 15 May 2012 14:56:06 GMT</pubDate></item><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 16:51:44 GMT]]></title><description><![CDATA[<p>Ich hab die implementierung von cooki ausprobiert leider funktioniert sie nicht ganz kann jemand es mal nur für diesen fall komplett implementieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2211829</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211829</guid><dc:creator><![CDATA[Weirdo1]]></dc:creator><pubDate>Tue, 15 May 2012 16:51:44 GMT</pubDate></item><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 19:38:26 GMT]]></title><description><![CDATA[<p>was funktioniert denn nicht? hast du deinem compiler gesagt, das er c++0x mittel nutzen muss(beim gcc z. B. -std=c++0x ) und du musst den header &lt;intitializer_list&gt; einbinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2211907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211907</guid><dc:creator><![CDATA[vario-500]]></dc:creator><pubDate>Tue, 15 May 2012 19:38:26 GMT</pubDate></item><item><title><![CDATA[Reply to String Klasse on Tue, 15 May 2012 19:45:20 GMT]]></title><description><![CDATA[<p>Und deine Stringklasse muss iteratoren bereitstellen. Falls die nur operator [] hat geht auch</p>
<pre><code class="language-cpp">std::ostream&amp; operator &lt;&lt; (std::ostream&amp; stream, const my_string&amp; s)
{
  for (std::size_t i = 0; i != s.size(); ++i)
    stream &lt;&lt; s[i];
  return stream;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2211910</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2211910</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Tue, 15 May 2012 19:45:20 GMT</pubDate></item></channel></rss>