Hiding of all overloaded methods with same name in base class
In C++, if a derived class redefines base class member method then all the base class methods with same name become hidden in derived class.
For example, the following program doesn’t compile. In the following program, Derived redefines Base’s method fun() and this makes fun(int i) hidden.
Even if the signature of the derived class method is different, all the overloaded methods in base class become hidden. For example, in the following program, Derived::fun(char ) makes both Base::fun() and Base::fun(int ) hidden.
Derived::fun(char c) called
Note that the above facts are true for both static and nonstatic methods.
There is a way mitigate this kind of issue. If we want to overload a function of a base class, it is possible to unhide it by using the ‘using’ keyword.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.