title: How can I pass a member function pointer into a function that takes a regular function pointer?
body: <p>I have a player class which looks like this (stripped down to what is needed for this problem):</p>
  
  <pre><code>class Player
  {
      public:
          Player();
          ~Player();
  
          void kill();
          void death();
          void reset();
  };
  </code></pre>
  
  <p>The <code>kill()</code>, <code>death()</code>, and <code>reset()</code> functions look like this:</p>
  
  <pre><code>void Player::kill()
  {
      void (*dPtr)() = &amp;death;
  
      Game::idle(dPtr, 48);
  }
  
  void Player::death()
  {
      reset();
  }
  
  void Player::reset()
  {
      //resets
  }
  </code></pre>
  
  <p>The idle function is a static memeber function of Game, which takes a function pointer and an integer n, and calls the function after n tick. Here is the function, the implementation shouldn't matter:</p>
  
  <pre><code>class Game {
      static void idle(void (*)(), int);
  };
  </code></pre>
  
  <p>This code gives me the error:</p>
  
  <pre><code>ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function.  Say '&amp;Player::death' [-fpermissive]
  </code></pre>
  
  <p>So I change the line from</p>
  
  <pre><code>    void (*dPtr)() = &amp;death;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>    void (Player::*dPtr)() = &amp;Player::death;
  </code></pre>
  
  <p>to solve that issue. But then my call to the idle function is incorrect, as it takes a regular function pointer, and I am passing in a member function pointer, and thus gives me the error:</p>
  
  <pre><code>no matching function for call to 'Game::idle(void (Player::*&amp;)(), int)'
  </code></pre>
  
  <p>So my question is:
  How can I pass the member function pointer <code>Player::*dPtr</code> into the idle function, which takes a <code>void (*)()</code> as an argument?</p>
  
  <p>Or is there another way I can solve my previous error which forbids me from taking the address of an unqualified member function to form a pointer to a member function?</p>