<?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[Funtkionszeiger]]></title><description><![CDATA[<p>Hi,</p>
<p>Ich befinde mich in der Funtkion einer Klasse und möchte einer Funktion einer anderen Klasse eine Funktion, der Klasse in der ich mich befinde, übergeben.</p>
<p>Komischerweise kommt dabei dieser Fehler:</p>
<pre><code>Fehler: invalid use of member (did you forget the »&amp;« ?)
 Fehler: expected primary-expression before »int«
</code></pre>
<p>Mein Programmiercode:</p>
<pre><code class="language-cpp">classB-&gt;functionB( void (*functionA)(int));
</code></pre>
<p>Irgendwie habe ich das Gefühl ich hab irgendwas vergessen... Dabei habe ich es genau so gemacht wie es <a href="http://tutorial.schornboeck.net/funkt_zeiger.htm" rel="nofollow">hier</a> beschrieben wurde.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/228066/funtkionszeiger</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 17:55:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/228066.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Nov 2008 16:46:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 16:46:49 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Ich befinde mich in der Funtkion einer Klasse und möchte einer Funktion einer anderen Klasse eine Funktion, der Klasse in der ich mich befinde, übergeben.</p>
<p>Komischerweise kommt dabei dieser Fehler:</p>
<pre><code>Fehler: invalid use of member (did you forget the »&amp;« ?)
 Fehler: expected primary-expression before »int«
</code></pre>
<p>Mein Programmiercode:</p>
<pre><code class="language-cpp">classB-&gt;functionB( void (*functionA)(int));
</code></pre>
<p>Irgendwie habe ich das Gefühl ich hab irgendwas vergessen... Dabei habe ich es genau so gemacht wie es <a href="http://tutorial.schornboeck.net/funkt_zeiger.htm" rel="nofollow">hier</a> beschrieben wurde.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619480</guid><dc:creator><![CDATA[dfdfdfd]]></dc:creator><pubDate>Sun, 23 Nov 2008 16:46:49 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 17:21:00 GMT]]></title><description><![CDATA[<p>schrieb mal bie der übergabe klasse::funkname hin also mit dem klassen namen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619499</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619499</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 23 Nov 2008 17:21:00 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 17:22:50 GMT]]></title><description><![CDATA[<p>Skym0sh0 schrieb:</p>
<blockquote>
<p>schrieb mal bie der übergabe klasse::funkname hin also mit dem klassen namen</p>
</blockquote>
<p>Den Namen der Klasse in der ich mich befinde?? Wie das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619502</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619502</guid><dc:creator><![CDATA[dfdfdfd]]></dc:creator><pubDate>Sun, 23 Nov 2008 17:22:50 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 17:34:38 GMT]]></title><description><![CDATA[<p>Er meint es wohl so:</p>
<pre><code class="language-cpp">classB-&gt;functionB( void (*classA::functionA)(int));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1619505</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619505</guid><dc:creator><![CDATA[Meiner]]></dc:creator><pubDate>Sun, 23 Nov 2008 17:34:38 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 18:46:20 GMT]]></title><description><![CDATA[<p>Meiner schrieb:</p>
<blockquote>
<p>Er meint es wohl so:</p>
<pre><code class="language-cpp">classB-&gt;functionB( void (*classA::functionA)(int));
</code></pre>
</blockquote>
<p>tatsächlich?<br />
Gleicher fehler...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619564</guid><dc:creator><![CDATA[dfdfdfd]]></dc:creator><pubDate>Sun, 23 Nov 2008 18:46:20 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 18:50:42 GMT]]></title><description><![CDATA[<p>Memberfunktionszeiger haben folgende Syntax:</p>
<pre><code class="language-cpp">void (classA::*functionA)(int)
</code></pre>
<p>Aber wenn du die Funktion nur übergeben willst, musst du sie nicht deklarieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619571</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 23 Nov 2008 18:50:42 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 18:51:56 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Memberfunktionszeiger haben folgende Syntax:</p>
<pre><code class="language-cpp">void (classA::*functionA)(int)
</code></pre>
</blockquote>
<p>Er/Sie braucht doch aber die Syntax beim Aufrufen, oder nicht? Also dass, was Skym0sh0 schon schrieb: <code>classB-&gt;functionB( &amp;classA::functionA );</code></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619572</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 23 Nov 2008 18:51:56 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 18:55:56 GMT]]></title><description><![CDATA[<p>Hab ich grad noch gesehen, daher der Edit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619574</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 23 Nov 2008 18:55:56 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 18:57:03 GMT]]></title><description><![CDATA[<p>Badestrand schrieb:</p>
<blockquote>
<p>Nexus schrieb:</p>
<blockquote>
<p>Memberfunktionszeiger haben folgende Syntax:</p>
<pre><code class="language-cpp">void (classA::*functionA)(int)
</code></pre>
</blockquote>
<p>Er/Sie braucht doch aber die Syntax beim Aufrufen, oder nicht? Also dass, was Skym0sh0 schon schrieb: <code>classB-&gt;functionB( &amp;classA::functionA );</code></p>
</blockquote>
<p>Funktioniert leider beides nicht, habe ich auch schon probiert... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Ich finde das sehr komisch.</p>
<p>Funktioniert das bei euch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619576</guid><dc:creator><![CDATA[dfdfdfd]]></dc:creator><pubDate>Sun, 23 Nov 2008 18:57:03 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 19:02:01 GMT]]></title><description><![CDATA[<p>sry, falscher thread</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619580</guid><dc:creator><![CDATA[root2k]]></dc:creator><pubDate>Sun, 23 Nov 2008 19:02:01 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Sun, 23 Nov 2008 19:15:46 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">struct A
{
	void func( int a )
	{
		std::cout &lt;&lt; &quot;I've got &quot; &lt;&lt; a &lt;&lt; &quot; dogs&quot; &lt;&lt; std::endl;
	}
};

void foo( A* obj, void(A::*fptr)(int), int val )
{
	((*obj.*fptr))( val );
}

int main()
{
	A a;
	foo( &amp;a, &amp;A::func, 120 );
}
</code></pre>
<p>edit: Zeiger auf Memberfunktionen unterscheiden sich leider ein wenig von Zeigern auf freie Funktionen, ist halt ein wenig komplizierter.. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619589</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 23 Nov 2008 19:15:46 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Mon, 24 Nov 2008 12:38:46 GMT]]></title><description><![CDATA[<p>ähm ja, so funktioniert das, aber ich befinde mich in einer Klasse und möchte die Funktion der Klasse, in der ich mich befinde, übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619864</guid><dc:creator><![CDATA[dfdfdfd]]></dc:creator><pubDate>Mon, 24 Nov 2008 12:38:46 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Mon, 24 Nov 2008 13:02:04 GMT]]></title><description><![CDATA[<p>dfdfdfd schrieb:</p>
<blockquote>
<p>ähm ja, so funktioniert das, aber ich befinde mich in einer Klasse und möchte die Funktion der Klasse, in der ich mich befinde, übergeben.</p>
</blockquote>
<p>Und wo genau ist das Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619879</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619879</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Mon, 24 Nov 2008 13:02:04 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Mon, 24 Nov 2008 13:07:11 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int main() 
{ 
    A a; 
    foo( &amp;a, &amp;A::func, 120 ); //Ich befinde mich in KlasseA, wie soll ich da a übergeben?
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1619881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619881</guid><dc:creator><![CDATA[dfdfdfd]]></dc:creator><pubDate>Mon, 24 Nov 2008 13:07:11 GMT</pubDate></item><item><title><![CDATA[Reply to Funtkionszeiger on Mon, 24 Nov 2008 13:16:33 GMT]]></title><description><![CDATA[<p>*this<br />
Aber an der Stelle würde ich auch mal auf Boost.function aufmerksam machen, was da sehr angenehm ist(auch mit boost::mem_fn und boost::bind)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619885</guid><dc:creator><![CDATA[JustAnotherNoob]]></dc:creator><pubDate>Mon, 24 Nov 2008 13:16:33 GMT</pubDate></item></channel></rss>