Consider the following code:
class Base
{
public:
virtual void f1( int var, bool val ) {/*some implementation*/}
virtual void f1( int var, int val ) {/*some implementation*/}
};
class Derived : public Base
{
public:
void f1( int var, int val ) {/*new implementation*/}
};
if I create a new derived object:
Derived* newObj = new Derived();
and call f1:
newObj->f1(5, true);
why would it call Derived's f1, converting the bool to int? clearly the arguments don't match and there is a more suitable candidate at the base class (the base function that acceps int and bool). Why overriding an overloaded virtual function from the base hides its other implementations?