vptr
#include <stdio.h> class Point3d { public: virtual ~Point3d(){} public: static Point3d origin; float x, y, z; }; //从打印的地址看出这个类的结构应该是vptr|x|y|z,vptr是放类空间的头部的 int main() { printf("Point3d::x%p\n", &Point3d::x) ;//这个是求x在类中的偏移量 //printf("Point3d::y%p\n", &Point3d::y) ; printf("Point3d::z--%p\n", &Point3d::z) ; //printf("Point3d::origin%p\n", &Point3d::origin) ; Point3d d; printf("Point3d--%p\n", &d);//求具体的地址 printf("Point3d::z--%p\n", &d.z);//求具体的地址 getchar(); return 0; }