#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 ", &Point3d::x) ;//这个是求x在类中的偏移量 //printf("Point3d::y%p ", &Point3d::y) ; printf("Point3d::z--%p ", &Point3d::z) ; //printf("Point3d::origin%p ", &Point3d::origin) ; Point3d d; printf("Point3d--%p ", &d);//求具体的地址 printf("Point3d::z--%p ", &d.z);//求具体的地址 getchar(); return 0; }