In the inheritance section, C ++ involves covering hidden overloading of functions. How can we differentiate them?
First, the function coverage condition: <1> the base class function must be a virtual function.
<2> the two functions that are overwritten must be located in the derived class and the base class respectively.
<3> the function name and parameter list are identical.
Second, function hiding mainly involves the following two situations:
<1> the functions of the derived class and the base class functions are identical (the function names and parameter lists are the same), but the base class functions do not use the virtual keyword. In this case, the function of the base class will be hidden rather than overwritten.
<2> a function of a derived class has the same name as a function of a base class, but the parameter list is different. In this case, no matter whether the function declaration of the base class has a virtual keyword, functions of the base class are hidden. Pay attention to the difference between this situation and function overload. The overload occurs in the same class.
Finally, the function overload condition occurs in the same class, with the same function name and different parameter class tables or types.