//多继承
/*
//人
class Person{
};
//公民
class Citizen{
};
//学生,既是人,又是公民
class Student : public Person, public Citizen{
};
*/
//继承的访问修饰
//基类中 继承方式 子类中
//public & public继承 = > public
//public & protected继承 = > protected
//public & private继承 = > private
//
//protected & public继承 = > protected
//protected & protected继承 = > protected
//protected & private继承 = > private
//
//private & public继承 = > 子类无权访问
//private & protected继承 = > 子类无权访问
//private & private继承 = > 子类无权访问
//人类
/*
class Human{
public:
void say(){
cout << "说话" << endl;
}
private:
char* name;
int age;
};
//男人
class Man : protected Human{
public:
//泡妞
void chasing(){
cout << "泡妞" << endl;
}
private:
//兄弟
char* brother;
};
*/
//继承的二义性
//虚继承,不同路径继承来的同名成员只有一份拷贝,解决不明确的问题
/*
class A{
public:
char* name;
};
class A1 : virtual public A{
};
class A2 : virtual public A{
};
class B : public A1, public A2{
};
void main(){
B b;
b.name = "jason";
//指定父类显示调用
//b.A1::name = "jason";
//b.A2::name = "jason";
system("pause");
}
*/