#include "stdafx.h"
class A
{
virtual void FunA(){ printf( "liangchao/r/n" ); }
virtual void FunB(){ printf( "liangchao1/r/n" ); }
};
typedef void (*pFunA)();
int _tmain(int argc, _TCHAR* argv[])
{
A a;
pFunA pfunA, pfunB;
int p = (int)(&a);
int i = *( (int*)p );//i是指向vtable的指针
i = *((int*)i);//i是函数FunA的地址
int j = *( (int*)p );
j = j +4;
j = *((int*)j);//i是函数FunA的地址
//void *q = (void*)(*p);
pfunA = (void (*)())( i );
pfunB = (void (*)())( j );
pfunA();
pfunB();
return 0;
}