If some or all of the direct base classes of a derived class are derived from another common base class, in these Russian base classes,
Members inherited from the base class at the upper level have the same name, so the same name will appear in the derived class. For members with the same name of this type, the scope identifier must also be used for unique identifiers, and the base class must be used for restriction.
--------------------------------------------------
/*
* File: Main. cpp
* Author: Yubao
*
* Created on May 31,200 9, AM
*/
# Include <iostream>
Using namespace STD;
Class B0
{
Public:
Int NV;
Void fun () {cout <"Member of B0" <Endl ;}
};
Class B1: Public B0
{
Public:
Int nv1;
};
Class B2: Public B0
{
Public:
Int nv2;
};
Class D1: Public B1, public B2
{
Public:
Int nvd;
Void fun () {cout <"Member of D1" <Endl ;}
};
/*
*
*/
Int main (INT argc, char ** argv ){
D1 D1;
D1.b1: NV = 2;
D1.b1: Fun ();
D1.b2: NV = 3;
D1.b2: Fun ();
Return 0;
}