多重继承的成员名二义性

    技术2022-06-26  67

    #include <iostream> using namespace std; class A { public: void f() {cout<<"From A"<<endl;} }; class B { public: void f() {cout<<"From B"<<endl;} }; class MI:public A,public B { public: void g() {cout<<"From MI"<<endl;} }; void main() { MI mi; mi.A::f(); mi.B::f(); }


    最新回复(0)