O
OvErboRed
I know you can do:
int (MyClass::*ptr)(int) = &MyClass::func;
cout << (myObj.*ptr)(5);
to point to a member function of class MyClass. But how would you go about
making this generic (i.e., not restricted to any specific class, like
MyClass)? You can probably resort to C function pointers, but I'd rather
not. Thanks in advance.
int (MyClass::*ptr)(int) = &MyClass::func;
cout << (myObj.*ptr)(5);
to point to a member function of class MyClass. But how would you go about
making this generic (i.e., not restricted to any specific class, like
MyClass)? You can probably resort to C function pointers, but I'd rather
not. Thanks in advance.