title: Calling Member function pointers from vector list
body: <p>I'm new to function pointers and I wrote a small program, where main class use Test class to populate a list with member function pointers.  And from my main class I want to call ExeFuns() to call each member function, which I'm not sure how to do. Any help is greatly appreciated. Thanks. </p>
  
  <p><strong>Test.h</strong></p>
  
  <pre><code>Class Test{
    public : 
     void CallFun1(); 
     void CallFun2();
  
     void AddFuns(); 
     void ExeFuns();      
  }; 
  </code></pre>
  
  <p><strong>Test.cpp</strong></p>
  
  <pre><code>std::vector&lt;void (Test::*) ()&gt; callist; 
  
  
  void Test::AddFuns(){
    callist.push_back(&amp;Test::CallFun1); 
    callist.push_back(&amp;Test::CallFun2); 
  }
  
  
  void Test::ExeFuns(){
    for (int i = 0 ; i&lt;eventlist.size(); i++)
    {
     callist[i](); // error!
    }
  }
  
  void Test::CallFun1(){ cout&lt;&lt;"Fun 1"&lt;&lt;endl; }
  void Test::CallFun2(){ cout&lt;&lt;"Fun 2"&lt;&lt;endl; }
  </code></pre>
  
  <p><strong>Main.cpp</strong></p>
  
  <pre><code>main()
  {
  Test obj; 
  obj.AddFuns(); 
  obj.ExeFuns(); 
  }
  </code></pre>