Static member function pointer to hold non static member function
<p>This has defeated me. I want to have a static class variable which is a pointer to a (non-static) member function. I've tried all sorts of ways, but with no luck (including using <code>typedef</code>s, which just seemed to give me a different set of errors). In the code below I have the static class function pointer <code>funcptr</code>, and I can call it successfully from outside the class, but not from within the member function <code>CallFuncptr</code> - which is what I want to do. Any suggestions?</p>

<pre><code>#include &lt;stdio.h&gt;

class A
{
public:
  static int (A::*funcptr)();
  int Four() { return 4;};
  int CallFuncptr() { return (this-&gt;*funcptr)(); } 
      // doesn't link -  undefined reference to `A::funcptr'
};
int (A::*funcptr)() = &amp;A::Four;

int main()
{
  A fred;
  printf("four? %d\n", (fred.*funcptr)());  // This works
  printf("four? %d\n", fred.CallFuncptr()); // But this is the way I want to call it
}
</code></pre>
