c++ 委托构造函数
1 #include<iostream> 2 int n=0; 3 using namespace std; 4 class Cbox{ 5 int a ; 6 int b ; 7 int c ; 8 public: 9 int g ; 10 Cbox(int d):Cbox(){cout<<"dddd"<<endl;} 11 Cbox(){cout<<"dddd1"<<endl;}; 12 ~Cbox(){cout<<a<<" "<<b<<" "<<c<<endl;} 13 }; 14 15 16 17 int main(){ 18 int aa=10; 19 Cbox a(10) ; 20 21 //Cbox b(a);//跟 Cbox b=a; 结果一样 22 23 24
![](https://images2015.cnblogs.com/blog/1163199/201705/1163199-20170525195346622-26956303.png)
25 26 27 }