#include <iostream>
class foo
{
public:
void foo_function() { std::cout << "Foo!" << std::endl;};
};
class bar
{
public:
foo foo_member;
void bar_function(foo bar::*p_foo)
{
(this->*p_foo).foo_function();
}
};
int main()
{
foo foo_obj;
bar bar_obj;
typedef foo bar::*p_foo;
p_foo blah = &bar::foo_member;
bar_obj.bar_function(blah);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgZm9vCnsKcHVibGljOgogICAgdm9pZCBmb29fZnVuY3Rpb24oKSB7IHN0ZDo6Y291dCA8PCAiRm9vISIgPDwgc3RkOjplbmRsO307Cn07CgpjbGFzcyBiYXIKewpwdWJsaWM6CiAgICBmb28gZm9vX21lbWJlcjsKCiAgICB2b2lkIGJhcl9mdW5jdGlvbihmb28gYmFyOjoqcF9mb28pCiAgICB7CiAgICAgICAgKHRoaXMtPipwX2ZvbykuZm9vX2Z1bmN0aW9uKCk7CiAgICB9Cn07CgoKaW50IG1haW4oKQp7CiAgICBmb28gZm9vX29iajsKICAgIGJhciBiYXJfb2JqOwogICAgdHlwZWRlZiBmb28gYmFyOjoqcF9mb287CiAgICBwX2ZvbyBibGFoID0gJmJhcjo6Zm9vX21lbWJlcjsKICAgIGJhcl9vYmouYmFyX2Z1bmN0aW9uKGJsYWgpOwogICAgcmV0dXJuIDA7Cn0K