#include "stdafx.h" #include <string.h> class A { public: A(){ printf("A constructor ");} }; class B { public: B(){ printf("B constructor ");} A a; }; class C { public: C(){ printf("C constructor ");} A *a; }; int _tmain(int argc, _TCHAR* argv[]) { B b; C c; getchar(); return 0; }
可以知道类C中A类指针*a并没有构造,而B类中A类构造了