title: C++ function pointer (class member) to non-static member function
body: <pre><code>class Foo {
  public:
      Foo() { do_something = &amp;Foo::func_x; }
  
      int (Foo::*do_something)(int);   // function pointer to class member function
  
      void setFunc(bool e) { do_something = e ? &amp;Foo::func_x : &amp;Foo::func_y; }
  
  private:
      int func_x(int m) { return m *= 5; }
      int func_y(int n) { return n *= 6; }
  };
  
  int
  main()
  {
      Foo f;
      f.setFunc(false);
      return (f.*do_something)(5);  // &lt;- Not ok. Compile error.
  }
  </code></pre>
  
  <p>How can I get this to work?</p>