Possible Duplicate:
Why does an overridden function in the derived class hide other overloads of the base class?
Does f(int) in base class inherited in derived derived class D? if yes then why overloading is not working here. and if no then why f(int) is not inherited as class d is publicly derived. I am confused.
class B {
public:
int f(int i) { cout << "f(int): "; return i+1; }
// ...
};
class D : public B {
public:
double f(double d) { cout << "f(double): "; return d+1.3; }
// ...
};
int main()
{
D* pd = new D;
cout << pd->f(2) << '\n';
cout << pd->f(2.3) << '\n';
}