#include <iostream>
using std::cout;
using std::endl;
class TestClass
{
void MyFunc(void);
public:
void PrintMyFuncAddress(void);
};
void TestClass::MyFunc(void)
{
return;
}
void TestClass::PrintMyFuncAddress(void)
{
//printf("%p\n", &TestClass::MyFunc);
void (TestClass::* ptrtofn)() = &TestClass::MyFunc;
cout << (void*&)ptrtofn<< endl;
}
int main(void)
{
TestClass a;
a.PrintMyFuncAddress();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCnVzaW5nIHN0ZDo6Y291dDsKdXNpbmcgc3RkOjplbmRsOwogCmNsYXNzIFRlc3RDbGFzcwp7CiAgdm9pZCBNeUZ1bmModm9pZCk7CiAKcHVibGljOgogIHZvaWQgUHJpbnRNeUZ1bmNBZGRyZXNzKHZvaWQpOwp9OwogCnZvaWQgVGVzdENsYXNzOjpNeUZ1bmModm9pZCkKewogIHJldHVybjsKfQogCnZvaWQgVGVzdENsYXNzOjpQcmludE15RnVuY0FkZHJlc3Modm9pZCkKewogIC8vcHJpbnRmKCIlcFxuIiwgJlRlc3RDbGFzczo6TXlGdW5jKTsKICB2b2lkIChUZXN0Q2xhc3M6OiogcHRydG9mbikoKSA9ICZUZXN0Q2xhc3M6Ok15RnVuYzsKICBjb3V0IDw8ICh2b2lkKiYpcHRydG9mbjw8IGVuZGw7Cn0KIAppbnQgbWFpbih2b2lkKQp7CiAgVGVzdENsYXNzIGE7CiAKICBhLlByaW50TXlGdW5jQWRkcmVzcygpOwp9