title: Why callback functions needs to be static when declared in class
body: <p>I was trying to declare a callback function in class and then somewhere i read the function needs to be static but It didn't explain why?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using std::cout;
  using std::endl;
  
  class Test
  {
  public:
      Test() {}
  
      void my_func(void (*f)())
      {
          cout &lt;&lt; "In My Function" &lt;&lt; endl;
          f(); //Invoke callback function
      }
  
      static void callback_func()
      {cout &lt;&lt; "In Callback function" &lt;&lt; endl;}
  };
  
  int main()
  {
      Test Obj;
      Obj.my_func(Obj.callback_func);
  }
  </code></pre>