#include <iostream>
struct Base
{
virtual void f(int x)
{
std::cout << "Base::f(int) called with " << x << std::endl;
}
virtual void f(double x)
{
std::cout << "Base::f(double) called with " << x << std::endl;
}
};
struct Derived
: Base
{
void f(int x)
{
std::cout << "Derived::f(int) called with " << x << std::endl;
}
};
int main()
{
Derived d;
Base &b = d;
b.f(7);
b.f(3.14);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IEJhc2UKewoJdmlydHVhbCB2b2lkIGYoaW50IHgpCgl7CgkJc3RkOjpjb3V0IDw8ICJCYXNlOjpmKGludCkgY2FsbGVkIHdpdGggIiA8PCB4IDw8IHN0ZDo6ZW5kbDsKCX0KCXZpcnR1YWwgdm9pZCBmKGRvdWJsZSB4KQoJewoJCXN0ZDo6Y291dCA8PCAiQmFzZTo6Zihkb3VibGUpIGNhbGxlZCB3aXRoICIgPDwgeCA8PCBzdGQ6OmVuZGw7Cgl9Cn07CgpzdHJ1Y3QgRGVyaXZlZAo6IEJhc2UKewoJdm9pZCBmKGludCB4KQoJewoJCXN0ZDo6Y291dCA8PCAiRGVyaXZlZDo6ZihpbnQpIGNhbGxlZCB3aXRoICIgPDwgeCA8PCBzdGQ6OmVuZGw7Cgl9Cn07CgppbnQgbWFpbigpCnsKCURlcml2ZWQgZDsKCUJhc2UgJmIgPSBkOwoJYi5mKDcpOwoJYi5mKDMuMTQpOwp9Cg==