<?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[Methode als Funktionszeiger]]></title><description><![CDATA[<p>Wie kann ich eine Methode einer Instanz als Funktionzeiger nutzen?</p>
<pre><code class="language-cpp">class foobar
{
  public:
    void hallo(void);
};

int main()
{
  foobar foo;
  void (*func)(void) = foo.hallo;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/148259/methode-als-funktionszeiger</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 14:09:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148259.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 May 2006 18:09:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Methode als Funktionszeiger on Wed, 24 May 2006 18:09:06 GMT]]></title><description><![CDATA[<p>Wie kann ich eine Methode einer Instanz als Funktionzeiger nutzen?</p>
<pre><code class="language-cpp">class foobar
{
  public:
    void hallo(void);
};

int main()
{
  foobar foo;
  void (*func)(void) = foo.hallo;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1064479</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1064479</guid><dc:creator><![CDATA[Ratsuchender]]></dc:creator><pubDate>Wed, 24 May 2006 18:09:06 GMT</pubDate></item><item><title><![CDATA[Reply to Methode als Funktionszeiger on Wed, 24 May 2006 18:13:05 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>siehe zum Beispiel <a href="http://oopweb.com/CPP/Documents/FunctionPointers/Volume/CCPP/callback/callback.html#member" rel="nofollow">hier</a>.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1064481</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1064481</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Wed, 24 May 2006 18:13:05 GMT</pubDate></item><item><title><![CDATA[Reply to Methode als Funktionszeiger on Thu, 25 May 2006 10:16:37 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
using namespace std;

class foobar
{
public:
  void hallo()
  {
    cout &lt;&lt; &quot;Funkion hallo()\n&quot;;
  }
};

int main()
{
  /**
   * ptr ist ein Zeiger auf eine Methode der Klasse foobar. Dieser
   * wird mit der Methode foobar::hallo initialisiert. Zu diesem
   * Zeitpunkt sind noch keine Instanzen der Klasse foobar notwendig
  */
  void (foobar::*ptr)(void);
  ptr = &amp;foobar::hallo;

  /**
   * Klasse foobar instanzieren. foo ist eine Instanz der Klasse
   * foobar, p_foo ein Zeiger auf dieses Objekt. Mithilfe des .*
   * bzw. des -&gt;* Operators und dem Oben erzeugten Zeiger lässt sich
   * die Methode hallo der Klasse foobar aufrufen
  */
  foobar foo;
  (foo.*ptr)();

  foobar* p_foo = &amp;foo;
  (p_foo-&gt;*ptr)();

  /**
   * Ausgabe:
   * Funkion hallo()
   * Funkion hallo()
  */
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1064772</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1064772</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 25 May 2006 10:16:37 GMT</pubDate></item></channel></rss>