c++ 继承的二义性

来源:百度知道 编辑:UC知道 时间:2024/07/03 13:28:02
设计父亲类(Father),母亲类(Mother),子女类(Child) .
主要数据有姓名、年龄、民族 .
子女继承父亲的姓,继承母亲的民族 .
输出子女的姓名、年龄、民族,及其父母的姓名、年龄、民族信息 .

class Father{
private:
string ming;
string minzu;
int nianling;
protected:
string xing;
};
class Father{
private:
string xing;
string ming;
int nianling;
protected:
string minzu;
};
class Child:public Father,public Mother
{
public:
string ming;
int nianling;
}

靠!建议严惩楼上的投票行为

多重继承
应该是要到这个

class child : public Father,public Mother