title: Passing a pointer to a class member function as a parameter
body: <p>I have written a small program where I am trying to pass a pointer to member function of a class to another function. Can you please help me and where I am going wrong..?</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  class test{
  public:
          typedef void (*callback_func_ptr)();
          callback_func_ptr cb_func;
  
          void get_pc();
  
          void set_cb_ptr(void * ptr);
  
          void call_cb_func();
  };
  void test::get_pc(){
           cout &lt;&lt; "PC" &lt;&lt; endl;
  }
  void test::set_cb_ptr( void *ptr){
          cb_func = (test::callback_func_ptr)ptr;
  }
  void test::call_cb_func(){
             cb_func();
  }
  int main(){
          test t1;
              t1.set_cb_ptr((void *)(&amp;t1.get_pc));
          return 0;
  }
  </code></pre>
  
  <p>I get the following error when I try to compile it.</p>
  
  <pre><code>error C2276: '&amp;' : illegal operation on bound member function expression
  </code></pre>