funcs with same names - in base and derived classes
Code:
#include <iostream>
#include <string>
using namespace std;
class base
{
public:
void foo() { cout << "base" << endl; }
};
class derived : public base
{
public:
void foo(const string& msg) { cout << "derived: " << msg << endl; }
};
int main()
{
derived d;
d.foo();
return 0;
}
the code produces following error:
error C2660: 'derived::foo' : function does not take 0 arguments
and it seems very silly to me :( why just cant the compiler use the base class version?