公有继承 父类中的public、protected属性,成为子类中的public、protected属性。 父类中的private,子类成员函数和子类对象不可以直接访问,但可以通过调用父类的get(),set()方法进行访问。 外部对象只能访问子类的public成员 保护继承 父类中public、protected属性,成为子类的protected属性。 私有继承 父类的public和protected,成为子类的private属性。 父类的private成员在子类中不可直接访问。