title: Error in Function pointers with C++
body: <p>Why is the following code results in error :</p>
  
  <pre class="lang-cpp prettyprint-override"><code>class A {
  
  public:
          typedef void (A::*funptr)(void);
  
          void fun(void ) {
                  cout &lt;&lt; " Fun Call " &lt;&lt;endl;
          }
  
          void foo(void ) {
                  cout &lt;&lt; " Foo Call " &lt;&lt;endl;
          }
  
          funptr p[2];
          funptr q;
  
          A()
          {
                  p[0]=&amp;A::foo;
                  p[1]=&amp;A::fun;
                  q   =&amp;A::fun;
          }
  };
  
  
  int main ()
  {
  
  A obj;
  
  (obj.*q)(void);
  
  //(obj.p[0])();
  //(obj.p[1])();
  
  return 0;
  }
  </code></pre>