🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 基类和派生类具有相同成员时 <details> <summary>main.cpp</summary> ``` #include <iostream> #include <string> using namespace std; class A { public: void show() { cout << "A-show"<<endl; } }; class B:public A { public: void show(){ cout<< "B-show"<< endl; A::show(); } }; int main() { B b; b.show(); return 0; } ``` </details> <br/> ## 实例中调用父类 ``` B b; b.show(); b.A::show(); ``` ## 多重继承的调用方法 ``` void show(){ A1::show(); A2::show(); } ```