title: How to create a thread of a pointer to a function C++
body: <p>I know that in order to create a thread of a method on an Object I can do it in this way:</p>
  
  <pre><code>#include &lt;thread&gt; 
  using namespace std;
  
  class Character
  {
  public:
      void myFunction(int a){ /* */ }
  
      void startThreadMyFunction(int a){
        thread Mf1(&amp;Character::myFunction, this, a);
      }
  };
  </code></pre>
  
  <p>Also I know that in order to have a pointer to a function in my class I can do it in this way:</p>
  
  <pre><code>#include &lt;thread&gt;  
  using namespace std;
  
  class Character
  {
  private:
      void (*FMoveForward)(int);// Pointer to a function.
  public:
      void setCommands(void(mf)(int delay)){//This function sets the pointer.
        FMoveForward = mf;
      }
      void MoveForward(int delay){
        FMoveForward(delay);// Here a call my function with my pointer to function.
      }
  };
  </code></pre>
  
  <p>My problem is that all the time when I try to use both of these things together the Visual Studio 13 compiler always complain about the sintaxe.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class Character
  {
  private:
      void (*FMoveForward)(int);
  public:
      void setCommands(void(mf)(int delay)){
        FMoveForward = mf;
      }
      void MoveForward(int delay){
        thread Mf1(&amp;Character::FMoveForward , this, delay);// The VS 13 Complain because the sintaxe os this line.
      }
  
  };
  </code></pre>
  
  <p>Does anyone knows how to solve it? TY in advanced...</p>