title: How can I use boost::bind to bind a class member function?
body: <pre><code>#include &lt;QtCore/QCoreApplication&gt;
  #include &lt;boost/bind.hpp&gt;
  #include &lt;boost/function.hpp&gt;
  
  class button
  {
   public:
  
      boost::function&lt;void()&gt; onClick;
      boost::function&lt;void(int ,double )&gt; onClick2;
  };
  
  class player
  {
   public:
      void play(int i,double o){}
      void stop(){}
  };
  
  button playButton, stopButton;
  player thePlayer;
  
  void connect()
  {
      //error C2298: 'return' : illegal operation on pointer to member function expression 
      playButton.onClick2 = boost::bind(&amp;player::play, &amp;thePlayer);
      stopButton.onClick = boost::bind(&amp;player::stop, &amp;thePlayer);
  }
  
  int main(int argc, char *argv[])
  
  {
  
      QCoreApplication a(argc, argv);
      connect();
      return a.exec();
  }
  </code></pre>