#include <iostream>
#include <vector>
struct Base {
virtual void f() { std::cout << "Base\n"; }
virtual ~Base(){}
};
struct Derived : Base {
void f() { std::cout << "Derived\n"; }
};
int main()
{
std::vector<Base> v;
v.push_back(Derived()); // bad idea
v[0].f();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgpzdHJ1Y3QgQmFzZSB7CiAgICB2aXJ0dWFsIHZvaWQgZigpIHsgc3RkOjpjb3V0IDw8ICJCYXNlXG4iOyB9CiAgICB2aXJ0dWFsIH5CYXNlKCl7fQp9OwpzdHJ1Y3QgRGVyaXZlZCA6IEJhc2UgewogICAgdm9pZCBmKCkgeyBzdGQ6OmNvdXQgPDwgIkRlcml2ZWRcbiI7IH0KfTsKaW50IG1haW4oKQp7CiAgICBzdGQ6OnZlY3RvcjxCYXNlPiB2OwogICAgdi5wdXNoX2JhY2soRGVyaXZlZCgpKTsgIC8vIGJhZCBpZGVhCiAgICB2WzBdLmYoKTsKfQo=