#include <iostream>
void g_func() { std::cout << "g-func!" << std::endl; }
class Foo
{
public:
void (*pfunc)();
void (Foo::*mfunc)();
void foo_func() { std::cout << "foo-func!" << std::endl; }
Foo() :
pfunc(g_func),
mfunc( &Foo::foo_func )
{}
};
int main() {
Foo foo;
foo.pfunc();
(foo.*(foo.mfunc))();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdm9pZCBnX2Z1bmMoKSB7IHN0ZDo6Y291dCA8PCAiZy1mdW5jISIgPDwgc3RkOjplbmRsOyB9CgpjbGFzcyBGb28KewpwdWJsaWM6Cgl2b2lkICgqcGZ1bmMpKCk7Cgl2b2lkIChGb286OiptZnVuYykoKTsKCgl2b2lkIGZvb19mdW5jKCkgeyBzdGQ6OmNvdXQgPDwgImZvby1mdW5jISIgPDwgc3RkOjplbmRsOyB9CgoJRm9vKCkgOgoJCXBmdW5jKGdfZnVuYyksCgkJbWZ1bmMoICZGb286OmZvb19mdW5jICkKCXt9Cgp9OwoKaW50IG1haW4oKSB7CglGb28gZm9vOwoJZm9vLnBmdW5jKCk7CgkoZm9vLiooZm9vLm1mdW5jKSkoKTsKCglyZXR1cm4gMDsKfQ==