菱形继承
class Person
{
int _AA;
};
class Student:public Person
{
int _BB;
};
class Teacher :public Person
{
int _CC;
};
class Assistant :public Student, public Teacher
{
int _DD;
};
PS:
Assistant的对象中存在两份Person成员
菱形继承存在二义性和数据冗余
菱形继承
class Person
{
int _AA;
};
class Student:public Person
{
int _BB;
};
class Teacher :public Person
{
int _CC;
};
class Assistant :public Student, public Teacher
{
int _DD;
};
PS:
Assistant的对象中存在两份Person成员
菱形继承存在二义性和数据冗余