Why is it that if a base class function is overloaded in the derived class, the base class version of the function (even if public) is not accessible through an object of the derived class?
Eg:
#include <iostream>
#include <string>
using namespace std;
class Base {
public:
void f(int i) {
cout << "\nInteger: " << i << endl;
}
};
class Derived : public Base {
public:
void f(string s) {
cout << "\nString: " << s << endl;
}
};
int main() {
Base b;
Derived d;
//d.f(5); Doesn't work
d.f("Hello");
//d.Base::f(5); works though
return 0;
}