How to invoke an object method passed to a variable?
class A {
public:
inline int f() {
return 1;
}
};
int main() {
A a;
int (A::*y)(); //'y' must be a method of 'A' class that returns 'int'
y = &A::f; //bind 'f' method
*y(); //how to invoke???
}
The other thread bound a method to an object field and it was invoked this way (a.*(a.x))()
, but i can't find a way to do a similar thing to a simple variable.