#include
using namespace std;
class Base1{
public:
Base1(int i){cout<<"Constructing Base1"<<i<<endl; }//父类1有参的构造函数
};
class Base2{
public:
Base2(int j){cout<<"Constructing Base2"<<j<<endl; }//父类2有参的构造函数
};
class Base3{
public:
Base3(void){cout<<"Constructing Base3 *"<<endl; }//父类3无参的构造函数
};
class Derived:public Base2,public Base1,public Base3//多个基类的继承
{
public:
Derived{int a,int b,int c,int d}:Base1(a),member2(d),member(c),Base2(b)
{}//派生类的构造函数定义
private:
Base1 member1;
Base2 member2;
Base3 member3;
};
int main()
Derived obj(1,2,3,4);//派生类析构函数的初始化
return 0;
}