#include<iostream.h>
#include<windows.h>
class Base1
{protected:
int number1;
public:
Base1()
{number1=0;
cout<<"number1:"<<number1<<endl;
}
};
class Base2
{protected:
int number2;
public:
Base2(int x)
{
number2=x;
cout<<"number2:"<<number2<<endl;
}
~Base2()
{
cout<<"xi gou:"<<endl;
}
};
class Base3
{protected:
int number3;
public:
Base3(int y)
{
number3=y;
cout<<"number3:"<<number3<<endl;
}
~Base3()
{
cout<<"xi gou:"<<endl;
}
};
class Derive:private Base1,private Base2,private Base3
{private:
Base1 number1base;
Base2 number2base;
Base3 number3base;
public:
Derive(int a,int b);
};
Derive::Derive(int a,int b):number2base(a),number3base(b)
{}
void main()
{
Derive st(4,3);
}
程序目的:三个基类,一个派生类,三个基类有析构,构造函数(一个基类的构造函数无参),派生类有三个私有成员
是三个基类的对象;
从头到尾查了一遍,剩一个错误不知道怎么改:
error C2512: 'Base2' : no appropriate default constructor available
error C2512: 'Base3' : no appropriate default constructor available
请问是什么意思,请高人指点一下..