初始化p
A(){ p = 0;cout<<"A::A()"<<endl;}
初始化列表 Initializer list
A():p(0){ cout<<"A::A()"<<endl;}
初始化vs赋值
赋值=默认初始化+赋值
尽量单独使用初始化
标签:初始化,cout,笔记,C++,自学,赋值 From: https://www.cnblogs.com/slowlydance2me/p/16730838.html
初始化p
A(){ p = 0;cout<<"A::A()"<<endl;}
A():p(0){ cout<<"A::A()"<<endl;}
赋值=默认初始化+赋值
尽量单独使用初始化
标签:初始化,cout,笔记,C++,自学,赋值 From: https://www.cnblogs.com/slowlydance2me/p/16730838.html