Quite a simple question actually but one which is bugging me a lot and I'm unable to find a sound answer for it.
How is the function call d.show();
NOT ambiguous for the following code AND why does b->show();
after b = &d;
leads to the calling of Base_::show()
?
#include <iostream>
using std::cout;
class Base_
{
public:
void show()
{
cout<<"\nBase Show";
}
};
class Derived_ : public Base_
{
public:
void show()
{
cout<<"Derived Show"<<endl;
}
};
int main()
{
Base_ b;
Derived_ d;
b->show();
d.show();
}