- Multiple inheritance
- The case that a class takes multiple direct base classes is called multiple inheritance, and a base class is single inheritance.
- A member function with the same name may appear in two base classes
- In a derived class, you must dissolve the ambiguity of the member functions of the two base classes, and the best way to do this is to redefine the function with the same name in the derived class. In this way, the derived class will localize the function, overwriting that function in the two base classes.
- We can also use scoped qualifiers to find some functions that we really need. ::
-
-
- Combine some unrelated classes, where there are many functions with the same name, and should eliminate the ambiguity of the use of these functions, and not just by the parameter type to make the function call and parse.
- Here we can eliminate ambiguity by making use of declarations.
-
C + + NOTE-Class hierarchy