#include <iostream>
struct A
{
void do_something() { std::cout << "A::do_something\n"; }
};
struct B : public A
{
virtual void do_something() override { std::cout << "B::do_something\n"; }
};
int main()
{
A a;
B b;
A* ptr = &a ;
ptr->do_something();
ptr = &b;
ptr->do_something();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IEEKewogICAgdm9pZCBkb19zb21ldGhpbmcoKSB7IHN0ZDo6Y291dCA8PCAiQTo6ZG9fc29tZXRoaW5nXG4iOyB9Cn07CgpzdHJ1Y3QgQiA6IHB1YmxpYyBBCnsKICAgIHZpcnR1YWwgdm9pZCBkb19zb21ldGhpbmcoKSBvdmVycmlkZSB7IHN0ZDo6Y291dCA8PCAiQjo6ZG9fc29tZXRoaW5nXG4iOyB9Cn07CgppbnQgbWFpbigpCnsKICAgIEEgYTsKICAgIEIgYjsKCiAgICBBKiBwdHIgPSAmYSA7CiAgICBwdHItPmRvX3NvbWV0aGluZygpOwoKICAgIHB0ciA9ICZiOwogICAgcHRyLT5kb19zb21ldGhpbmcoKTsKfQ==