K
keith
I posted something similar to this earlier in the week, but never saw
it appear, so I'll try again. My apologies if this appears to be a
dupe where you are.
If I have something like the following:
class Base
{
public:
void f(string&);
};
class Derived : public Base
{
public:
void f(char*);
};
int main()
{
string myStr = "abc";
Derived obj;
obj.f(myStr);
}
I get a compile-time error like this:
no matching function for call to `Derived::f (string &)'
candidates are: void Derived::f(char *)
Why does it not find the correctly matching function from the Base
class?
it appear, so I'll try again. My apologies if this appears to be a
dupe where you are.
If I have something like the following:
class Base
{
public:
void f(string&);
};
class Derived : public Base
{
public:
void f(char*);
};
int main()
{
string myStr = "abc";
Derived obj;
obj.f(myStr);
}
I get a compile-time error like this:
no matching function for call to `Derived::f (string &)'
candidates are: void Derived::f(char *)
Why does it not find the correctly matching function from the Base
class?