overloading base class method in derived class

Its called Name Hiding. When you define a non virtual method with the same name as Base method it hides the Base class method in Derived class so you are getting the error for

 myDerived.method_A(1,2);

To avoid hiding of Base class methods in Derived class use using keyword as you did in Derived2 class.

Also if you want to make it work you can do it explictly

myDerived.Base::method_A(1,2);

Check out this for better explanation why name hiding came into picture.

Leave a Comment