the code produces following error: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; }
error C2660: 'derived::foo' : function does not take 0 arguments
and it seems very silly to mewhy just cant the compiler use the base class version?


why just cant the compiler use the base class version?
but you got the point I hope).