<?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[static im funktionskopf]]></title><description><![CDATA[<p>hallo!<br />
was bewirkt denn ein &quot;static&quot; vor dem rückgabetyp einer funktion? heißt das nun nur, das der rückgabewert statisch ist?<br />
falls ja, warum kann ich eine memberfunktion einer klasse, die &quot;static&quot; dranstehen hat, aufrufen ohne das es ein objekt der klasse gibt?</p>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/124085/static-im-funktionskopf</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 20:17:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/124085.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Oct 2005 15:13:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to static im funktionskopf on Sun, 23 Oct 2005 15:13:03 GMT]]></title><description><![CDATA[<p>hallo!<br />
was bewirkt denn ein &quot;static&quot; vor dem rückgabetyp einer funktion? heißt das nun nur, das der rückgabewert statisch ist?<br />
falls ja, warum kann ich eine memberfunktion einer klasse, die &quot;static&quot; dranstehen hat, aufrufen ohne das es ein objekt der klasse gibt?</p>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/899371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/899371</guid><dc:creator><![CDATA[chris&#x27; 1]]></dc:creator><pubDate>Sun, 23 Oct 2005 15:13:03 GMT</pubDate></item><item><title><![CDATA[Reply to static im funktionskopf on Sun, 23 Oct 2005 15:16:39 GMT]]></title><description><![CDATA[<p>Nicht der Rückgabewert ist statisch, sondern die Funktion selber. Deshalb kannst du eine statische Funktion aufrufen, ohne eine konkrete Instanz des Objekts zu haben.</p>
<pre><code class="language-cpp">class Foo {
  //Statische Funktion
  static void bar() { //... }
};

//Aufruf:
Foo::bar();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/899378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/899378</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Sun, 23 Oct 2005 15:16:39 GMT</pubDate></item><item><title><![CDATA[Reply to static im funktionskopf on Sun, 23 Oct 2005 15:26:29 GMT]]></title><description><![CDATA[<p>chris' schrieb:</p>
<blockquote>
<p>hallo!<br />
was bewirkt denn ein &quot;static&quot; vor dem rückgabetyp einer funktion? heißt das nun nur, das der rückgabewert statisch ist?</p>
</blockquote>
<p>Ne. In diesem Fall besagt das static, dass die Funktion interne linkage hat. (d.h., dass sie nur in der ÜE aufrufbar ist, in der sie auch definiert wurde).</p>
<blockquote>
<p>falls ja, warum kann ich eine memberfunktion einer klasse, die &quot;static&quot; dranstehen hat, aufrufen ohne das es ein objekt der klasse gibt?</p>
<p>gruß</p>
</blockquote>
<p>Das static bei einer Memberfunktion bedeutet, dass diese Funktion <em>unabhängig</em> von einem Objekt existiert. D.h. dass du sie ohne ein Objekt aufrufen kannst. Allerdings weiß ich jetzt auch nicht, ob das Linkage von static Member-Funktionen äquivalent zu normalen static Funktionen ist.</p>
<p>/edit: static Member-Funktionen haben externes Linkage.</p>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/899381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/899381</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Sun, 23 Oct 2005 15:26:29 GMT</pubDate></item><item><title><![CDATA[Reply to static im funktionskopf on Sun, 23 Oct 2005 15:18:05 GMT]]></title><description><![CDATA[<p>chris' schrieb:</p>
<blockquote>
<p>hallo!<br />
was bewirkt denn ein &quot;static&quot; vor dem rückgabetyp einer funktion? heißt das nun nur, das der rückgabewert statisch ist?<br />
falls ja, warum kann ich eine memberfunktion einer klasse, die &quot;static&quot; dranstehen hat, aufrufen ohne das es ein objekt der klasse gibt?</p>
<p>gruß</p>
</blockquote>
<p>dieses static macht nix am typen, sondern manct die ganze funktion static.</p>
<p>isses ne globale funktion heißt das, daß ne andere *.cpp sie nicht aufrufen kann. (linker verweigert es).</p>
<p>isses ne methode, wird sie zu ner methode, die ohne objekt (ohne this) geht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/899382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/899382</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sun, 23 Oct 2005 15:18:05 GMT</pubDate></item><item><title><![CDATA[Reply to static im funktionskopf on Sun, 23 Oct 2005 16:18:56 GMT]]></title><description><![CDATA[<p>super, danke euch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>achja: methode=memberfunktion ja?<br />
und was ist eine &quot;ÜE&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/899412</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/899412</guid><dc:creator><![CDATA[chris&#x27; 1]]></dc:creator><pubDate>Sun, 23 Oct 2005 16:18:56 GMT</pubDate></item><item><title><![CDATA[Reply to static im funktionskopf on Sun, 23 Oct 2005 16:41:34 GMT]]></title><description><![CDATA[<p>Hallo</p>
<blockquote>
<p>achja: methode=memberfunktion ja?</p>
</blockquote>
<p>ja</p>
<blockquote>
<p>und was ist eine &quot;ÜE&quot;?</p>
</blockquote>
<p>Übersetungseinheit. i.a. eine einzelne Quellcode-Datei mitsamt ihren ganzen Inludes.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/899453</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/899453</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 23 Oct 2005 16:41:34 GMT</pubDate></item></channel></rss>