#include <iostream>
using std::cout;
using std::endl;
struct Base
{
virtual void f(int) { cout << "Base::f(int)" << endl; }
virtual void f(double){ cout << "Base::f(double)" << endl; }
};
struct Derived : public virtual Base
{
using Base::f;
virtual void f(int) { cout << "Derived::f(int)" << endl; }
};
int main()
{
Base b;
Derived d;
Base *pb = new Derived;
Base &dr (d);
b.f(1.0);
d.f(1.0);
pb->f(1.0);
dr.f(1.0);
delete pb;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBzdGQ6OmNvdXQ7CnVzaW5nIHN0ZDo6ZW5kbDsKCnN0cnVjdCBCYXNlCnsKICAgIHZpcnR1YWwgdm9pZCBmKGludCkgICB7IGNvdXQgPDwgIkJhc2U6OmYoaW50KSIgICAgPDwgZW5kbDsgfQogICAgdmlydHVhbCB2b2lkIGYoZG91YmxlKXsgY291dCA8PCAiQmFzZTo6Zihkb3VibGUpIiA8PCBlbmRsOyB9Cn07CnN0cnVjdCBEZXJpdmVkIDogcHVibGljIHZpcnR1YWwgQmFzZQp7CiAgICB1c2luZyBCYXNlOjpmOwogICAgdmlydHVhbCB2b2lkIGYoaW50KSAgIHsgY291dCA8PCAiRGVyaXZlZDo6ZihpbnQpIiA8PCBlbmRsOyB9Cn07CgppbnQgbWFpbigpCnsKICAgIEJhc2UgYjsKICAgIERlcml2ZWQgZDsKICAgIEJhc2UgKnBiID0gbmV3IERlcml2ZWQ7CiAgICBCYXNlICZkciAoZCk7CgogICAgYi5mKDEuMCk7CiAgICBkLmYoMS4wKTsKICAgIHBiLT5mKDEuMCk7CiAgICBkci5mKDEuMCk7CgogICAgZGVsZXRlIHBiOwp9Cg==