标签:class 类 c++ name type table
void PrintClassName(void *p)
{
type_info *** vtable = (type_info
***)(*(int*)p);
type_info ** v1 = vtable[-1];
type_info * v =
v1[3];
printf("printName: %s\n", v->name());
}
前提:该类必须有virtual 成员
例如:
class class1
{
char a;
double b;
public:
virtual
~class1(){}
};
标签:class 类 c++ name type table
原文地址:http://www.cnblogs.com/xiao0913/p/3781686.html