S
Steve Canfield
When compiling the following code:
class Base
{
...
virtual void Fn(int x);
virtual void Fn(Base x);
};
class Derived : public Base
{
...
virtual void Fn(Base x);
};
Derived d;
d.Fn(5);
I get the following error:
no matching function for call to `Derived::Fn(int)'
candidates are: void Derived::Fn(Base)
Shouldn't the compiler (g++) see the public function Base::Fn(int)?
The errors go away if I help the compiler out:
d.Base::Fn(5)
but I'm not sure why I need to do that.
-steve
class Base
{
...
virtual void Fn(int x);
virtual void Fn(Base x);
};
class Derived : public Base
{
...
virtual void Fn(Base x);
};
Derived d;
d.Fn(5);
I get the following error:
no matching function for call to `Derived::Fn(int)'
candidates are: void Derived::Fn(Base)
Shouldn't the compiler (g++) see the public function Base::Fn(int)?
The errors go away if I help the compiler out:
d.Base::Fn(5)
but I'm not sure why I need to do that.
-steve