继承,多重继承与虚继承

1.继承其实就是在一个类的基础上扩展新的功能的类型。 #include <iostream> using namespace std; class Animal { private: int age; public: void eat() { age = 88; cout <<"animal eat" << endl; }; }; // Animal叫作Human的父类, Human是Animal
相关文章
相关标签/搜索