title: C++: Function pointer to another class function
body: <p>I have 2 classes</p>
  
  <pre><code>class B {
  public:
      int func(int i);
  };
  
  class A {
  public:
      typedef int (B::*fPtr)(int);
      void run();
      B* mB;
  };
  
  void A::run() {
      // create a pointer
      fPtr p = &amp;(B::func);
      // invoke the function
      mB-&gt;*p(2);     &lt;------- Compilation Error
  }
  </code></pre>
  
  <p>What i need is to create a pointer to func() in A's run function. I get a compilation error  saying that mB is not corresponding to a function with 1 argument.</p>
  
  <p>please help </p>