1。public继承——using 声明式
class Base { private: int x; public: virtual void mf1() = 0; virtual void mf1(int) ; virtual void mf2(); void mf3(); void mf3(double); ... }; class Derived: public Base { public: using Base::mf1; //让Base Class内名为mf1和mf3的所有东西在Derived作用域内都可见(并且public) using Base::mf3; virtual void mf1(); void mf3(); void mf4(); ... };
2。private继承——转交函数
class Base { private: int x; public: virtual void mf1() = 0; virtual void mf1(int) ; virtual void mf2(); void mf3(); void mf3(double); ... }; class Derived: public Base { public: virtual void mf1() //转交函数 { Base::mf1(); } //暗自成为inline void mf3(); void mf4(); ... };