I have a function with the same name, but with different signature in a base and derived classes. When I am trying to use the base class\'s function in another class that in
Functions in derived classes which don't override functions in base classes but which have the same name will hide other functions of the same name in the base class.
It is generally considered bad practice to have have functions in derived classes which have the same name as functions in the bass class which aren't intended to override the base class functions as what you are seeing is not usually desirable behaviour. It is usually preferable to give different functions different names.
If you need to call the base function you will need to scope the call by using A::foo(s)
. Note that this would also disable any virtual function mechanism for A::foo(string)
at the same time.