Consider the following example:
struct Base
{
virtual void fun() = 0;
void fun(float) { fun(); }
};
struct Derived : Base
{
void fun() override {}
void bar()
{
// calling Base1::fun from, which in turn should call Derived::fun
fun(42.42f); // error "Function does not take 1 argument"
Base::fun(42.42f); // ok
}
};
Why is it necessary to specify the scope of fun
in such a case? Shouldn't the base class's fun
be taken into account implicitly?
Why does removing the definition of Derived::fun
cause a successful compilation?