How to execute a pointer to class member function within the same class?

  • Thread starter Thread starter AndyVv
  • Start date Start date
A

AndyVv

Guest
Here is what I am trying to do.

class A

{

typedef void (A::*pfn(void));

void func1 () {/*do something*/};

void func2()

{

pfn _pfn;

_pfn = &A::func1;

//now I am trying to execute func1 by using function pointer _pfn.

_pfn(); //error C2064: term does not evaluate to a function taking 0 arguments

}

};

So how do you call a pointer to function from within the same class?

Continue reading...
 
Back
Top