<?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[statische Funktionen]]></title><description><![CDATA[<p>Hallo, könnt ihr mir vielleicht kurz helfen?</p>
<p>Es geht um statische Methoden:</p>
<p>wie genau muss ich eine statische Methode in meinen *.h und *.cpp definieren bzw. deklarieren?</p>
<p>Meine <strong>Process.h</strong></p>
<pre><code class="language-cpp">class Process
{
public:
static void processAlgorithm();

};
</code></pre>
<p>Meine <strong>Process.cpp</strong></p>
<pre><code class="language-cpp">static void Process::processAlgorithm(std::string _filepath){	
	std::cout &lt;&lt;&quot;Process&quot; &lt;&lt; std::endl;
}
</code></pre>
<p>Wenn ich dies auf diese Art implementiere bekomme ich immer die Fehlermeldung:<br />
<em>candidate is static void Process::processAlgorithm()</em></p>
<p>Ich brauche diese static Methode da ich ja keine Instanz meiner Classe erzeugen möchte.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/228321/statische-funktionen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 16:37:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/228321.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Nov 2008 18:10:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to statische Funktionen on Wed, 26 Nov 2008 18:10:55 GMT]]></title><description><![CDATA[<p>Hallo, könnt ihr mir vielleicht kurz helfen?</p>
<p>Es geht um statische Methoden:</p>
<p>wie genau muss ich eine statische Methode in meinen *.h und *.cpp definieren bzw. deklarieren?</p>
<p>Meine <strong>Process.h</strong></p>
<pre><code class="language-cpp">class Process
{
public:
static void processAlgorithm();

};
</code></pre>
<p>Meine <strong>Process.cpp</strong></p>
<pre><code class="language-cpp">static void Process::processAlgorithm(std::string _filepath){	
	std::cout &lt;&lt;&quot;Process&quot; &lt;&lt; std::endl;
}
</code></pre>
<p>Wenn ich dies auf diese Art implementiere bekomme ich immer die Fehlermeldung:<br />
<em>candidate is static void Process::processAlgorithm()</em></p>
<p>Ich brauche diese static Methode da ich ja keine Instanz meiner Classe erzeugen möchte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621315</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621315</guid><dc:creator><![CDATA[redbomber]]></dc:creator><pubDate>Wed, 26 Nov 2008 18:10:55 GMT</pubDate></item><item><title><![CDATA[Reply to statische Funktionen on Wed, 26 Nov 2008 18:16:06 GMT]]></title><description><![CDATA[<p>redbomber schrieb:</p>
<blockquote>
<p>Meine <strong>Process.cpp</strong></p>
<pre><code class="language-cpp">static void Process::processAlgorithm(std::string _filepath){	
	std::cout &lt;&lt;&quot;Process&quot; &lt;&lt; std::endl;
}
</code></pre>
</blockquote>
<p>Das static gehört nicht an diese Stelle, sondern nur in die Deklaration der Klasse. Ebenso bei z.B. virtual.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621321</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Wed, 26 Nov 2008 18:16:06 GMT</pubDate></item><item><title><![CDATA[Reply to statische Funktionen on Wed, 26 Nov 2008 18:16:17 GMT]]></title><description><![CDATA[<p>halt, halt, halt<br />
das meinte ich garnicht, sorry. Der Parameter hatte ja noch gefehlt.</p>
<p>SORRY!!</p>
<p>Also:<br />
Meine <strong>Process.h</strong></p>
<pre><code class="language-cpp">class Process
{
public:
static void processAlgorithm();
//void readFile(std::string);

};
</code></pre>
<p>Meine <strong>Process.cpp</strong></p>
<pre><code class="language-cpp">#include &quot;Process.h&quot;

static void Process::processAlgorithm(){

	std::cout &lt;&lt;&quot;Process&quot; &lt;&lt; std::endl;

}
</code></pre>
<p>Und der Fehler ist: <em>Cannot declare Member function..</em></p>
<p>Wie bitte soll dann eine statische Methode in der *.cpp definiert werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621322</guid><dc:creator><![CDATA[redbomber]]></dc:creator><pubDate>Wed, 26 Nov 2008 18:16:17 GMT</pubDate></item><item><title><![CDATA[Reply to statische Funktionen on Wed, 26 Nov 2008 18:17:26 GMT]]></title><description><![CDATA[<p>super! Vielen Dank.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621324</guid><dc:creator><![CDATA[redbomber]]></dc:creator><pubDate>Wed, 26 Nov 2008 18:17:26 GMT</pubDate></item><item><title><![CDATA[Reply to statische Funktionen on Wed, 26 Nov 2008 19:03:57 GMT]]></title><description><![CDATA[<p>Wenn ich jetzt aber solch eine statische Methode verwende, dann hab ich doch den Nachteil, dass ich keine Objekte (von anderen Klassen) in dem Header Deklarieren kann, bzw. diese statisch deklariert werden müssen.</p>
<p>Ich möchte die Objekte im Header Deklarieren, damit sie mir als globale Objekte zur Verfügung stehen.</p>
<p>Wenn diese nun statisch sind, besitzte ich ja von jedem Objekt nur eine Instanz.</p>
<p>Kann ich die Werte in einem solchen Objekt aber später trotzdem noch ändern, also auch wenn dieses statisch ist, oder müssen in einem statischem Objekt auch alle Datentypen statisch deklariert werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621355</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621355</guid><dc:creator><![CDATA[redbomber]]></dc:creator><pubDate>Wed, 26 Nov 2008 19:03:57 GMT</pubDate></item><item><title><![CDATA[Reply to statische Funktionen on Wed, 26 Nov 2008 19:16:33 GMT]]></title><description><![CDATA[<p>Was du redest, ist ziemlich wirr. Ich kann dein Problem nicht ganz nachvollziehen.</p>
<p>Variablen der Speicherklasse <code>static</code> bleiben bis zum Beenden des Programms erhalten. In Klassen deklarierte statische Variablen sind von erstellten Objekten unabhängig. Jedoch können sie wie normale Variablen verändert werden. Vielleicht solltest du dich noch genauer über <code>static</code> informieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621364</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621364</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 26 Nov 2008 19:16:33 GMT</pubDate></item></channel></rss>