#include<iostream> using namespace std; class Base { public: Base(){ cout<<"hello"<<endl; } Base (int _a ):base(_a){ // 将_a赋值给base base++; cout << base << endl; } Base (int _a ,float _b):base(_a),th(_b){ cout << base + th <<endl; } Base ( int _a, a float _B, int _c): Base (_a), TH (_B), XH (_c) { COUT << Base + TH + XH << endl; } void Fun0 () {COUT < < Base << endl;} int Base ; a float TH; int XH; }; int main () { // Base B; is only one such constructor to call otherwise an error Base C (); // call the default constructor Base T ( 10 ;) // shorthand parameterized constructor call of t.fun0 (); . T Base = 100 ; t.fun0 (); Base T1 = Base ( 100 , 88.12 ); // call the constructor with reference to Base T2 = ( 10 , 100.12 , 20 is ); // }
Note: Base t2 = (10,100.12,20); result output in the wrong black Bantu.