#include <iostream>using namespace std;class Sofa
{
private:string sitting;
public:Sofa(){cout << "沙发的无参构造函数" << endl;}Sofa(string s):sitting(s){cout << "沙发的有参构造函数" << endl;}void show(){cout << sitting << endl;}
};class Bed
{
private:string sleep;
public:Bed(){cout << "床的无参构造函数" << endl;}Bed(string s):sleep(s){cout << "床的有参构造函数" << endl;}void show(){cout << sleep << endl;}
};class Sofa_Bed:public Bed,protected Sofa
{private:string size;
public:Sofa_Bed(){cout << "沙发床的无参构造函数" << endl;}Sofa_Bed(string b, string z, string s):Bed(b), Sofa(z), size(s){cout << "沙发床的有参构造函数" << endl;}void show(){Sofa::show();cout << size << endl;}
};
int main()
{Sofa_Bed s("能睡","能躺","kingsize");//s.Sofa::show();s.Bed::show();s.show();return 0;
}