#include <stdio.h>
#include <string.h>
class test
{
public:
test(int i){ m_i=i;}
test(){};
void hello()
{
printf("hello\n");
}
private:
int m_i;
};
/*
int main()
{
test *p=new test();
p->hello();
delete p;
p=NULL;
p->hello();
return 0;
}
//*/
//*
typedef void (test::*HELLO_FUNC)();
typedef void (*HELLO_FUNC2)();
int main()
{
test *p=new test();
test q;
p->hello();
HELLO_FUNC phello_fun=&test::hello;
(p->*phello_fun)();
HELLO_FUNC2 func2;
memcpy(&func2,&phello_fun,sizeof(phello_fun));
(*func2)();
printf("%p\n",phello_fun);
p=NULL;
phello_fun=&test::hello;
printf("%p\n",phello_fun);
phello_fun=p->hello;
printf("%p\n",phello_fun);
phello_fun=q.hello;
printf("%p\n",phello_fun);
p->hello();
return 0;
}
//*/