I am just testing with virtual keyword and inheritance concepts in c++. I have written a small program:
#include
#include
us
Once you overload a function from Base class in Derived class all functions with the same name in the Base class get hidden in Derived class.
Once you added the function cna_bsc::print(int a)
to your derived class the function cna_MO::::print()
is no longer visible to users of the Derived class. This is known as function hiding.
Solution: In order to make the hidden function visible in derived class, You need to add:
using cna_MO::print;
in the public
section of your derived class cna_bsc
.
Good Read:
What's the meaning of, Warning: Derived::f(char) hides Base::f(double)?