The code is :
#include <iostream>
using namespace std;
class A
{
public:
void fun()
{
cout << "A::fun()" << endl;
}
void fun(int i)
{
cout << "A::fun(int)" << endl;
}
};
class B:public A
{
public:
void fun()
{
cout << "B::fun()" << endl;
}
};
int main()
{
B b;
b.fun(5); // throws an error.
return 0;
}
In public inheritance, all the member function can be accessed with derived object. But, it is throwing me an error, when I try to access the member function of the base class. Why?