views:

65

answers:

0

Possible Duplicate:
Why does an overridden function in the derived class hide other overloads of the base class?

I recently came across this interesting inheritance example -

class FirstClass
{
public:
        void MethodA (int) { cout << "ONE\n";}
        void MethodA (int, int) { cout << "TWO\n";}
};

class SecondClass : public FirstClass
{
public:
        void MethodA (int) { cout << "THREE\n";}
};

int main ()
{
        SecondClass a;
        a.MethodA (1,1);
        getch();
}

When you compile this code you get the following error message -

No matching function for call to 'SecondClass::MethodA(int, int)' 

Can anyone explain why do I get this error message. The MethodA(int, int) should have been inherited by SecondClass.