Skip to content

Instantly share code, notes, and snippets.

@Lendar
Created April 2, 2012 08:21
Show Gist options
  • Save Lendar/2281616 to your computer and use it in GitHub Desktop.
Save Lendar/2281616 to your computer and use it in GitHub Desktop.
c++ method pointer
class SomeClass {
public:
int SomeMethod(int i, int j) {
return i+j;
}
}
...
typedef int (SomeClass::*SomeMethodSig) (int, int);
...
{
SomeMethodSig f = &SomeClass::SomeMethod;
SomeClass *obj = new SomeClass();
(obj->*f)(3, 4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment