代码:
1 #include <iostream> 2 3 using namespace std; 4 5 class A{ 6 public: 7 int a; 8 }; 9 10 int main(){ 11 12 A *a1 = new A; 13 A *a2 = new A(); 14 cout<<a1->a<<endl; 15 cout<<a2->a<<endl; 16 17 A a3; 18 cout<<a3.a<<endl; 19 20 return 0; 21 }
输出:
0 0 4196736
分析:
可以参考https://www.zhihu.com/question/35843839
原文:http://www.cnblogs.com/hu983/p/5513699.html