The definition of overloaded functions: several functions within the same scope have the same name but different parameter lists, called overloaded functions. Here is an important premise: the same scope;
If the overloaded function is defined in a different scope, then once the compiler finds the desired name in the current scope, the compiler ignores the entity with the same name in the outer scope. The rest of the work is to check if the function call is valid.
Because in this C + +, the lookup of the name occurs before the type check, if a name is found in the current scope, and if there are multiple names, the parameters are matched. If the current scope has only one name, the outer scope is ignored directly for type checking.
The inheritance system of a class also conforms to this situation, so it is best not to reuse the names defined in other base classes in addition to overriding the inherited virtual functions. In this case, the names in the derived class will simply overwrite the members with the same name in the base class.
C + + name lookup and overloading