#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;
class A
{
public:
virtual void f() { cout << "A" << endl; }
};
class B : public A
{
public:
void f() { cout << "B" << endl; }
};
int main()
{
vector<A*> items;
items.push_back(new A());
items.push_back(new B());
items[0]->f();
items[1]->f();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgc3RkOjpjb3V0Owp1c2luZyBzdGQ6OmVuZGw7CnVzaW5nIHN0ZDo6dmVjdG9yOwoKY2xhc3MgQQp7CiAgICBwdWJsaWM6CiAgICAgICAgdmlydHVhbCB2b2lkIGYoKSB7IGNvdXQgPDwgIkEiIDw8IGVuZGw7IH0KfTsKCmNsYXNzIEIgOiBwdWJsaWMgQQp7CiAgICBwdWJsaWM6CiAgICAgICAgdm9pZCBmKCkgeyBjb3V0IDw8ICJCIiA8PCBlbmRsOyB9Cn07CgppbnQgbWFpbigpCnsKICAgIHZlY3RvcjxBKj4gaXRlbXM7CiAgICBpdGVtcy5wdXNoX2JhY2sobmV3IEEoKSk7CiAgICBpdGVtcy5wdXNoX2JhY2sobmV3IEIoKSk7CiAgICBpdGVtc1swXS0+ZigpOwogICAgaXRlbXNbMV0tPmYoKTsKICAgIHJldHVybiAwOwp9Cg==