#include <iostream>
class base
{
public:
virtual void print() { std::cout << "base"; }
};
class derived : public base
{
private:
virtual void print() { std::cout << "derived"; }
};
int main()
{
base * base_ptr = new derived();
base_ptr->print();
delete base_ptr;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgYmFzZQp7CnB1YmxpYzoKCXZpcnR1YWwgdm9pZCBwcmludCgpIHsgc3RkOjpjb3V0IDw8ICJiYXNlIjsgfQp9OwoKY2xhc3MgZGVyaXZlZCA6IHB1YmxpYyBiYXNlCnsKcHJpdmF0ZToKCXZpcnR1YWwgdm9pZCBwcmludCgpIHsgc3RkOjpjb3V0IDw8ICJkZXJpdmVkIjsgfQp9OwoKaW50IG1haW4oKQp7CgliYXNlICogYmFzZV9wdHIgPSBuZXcgZGVyaXZlZCgpOwoJYmFzZV9wdHItPnByaW50KCk7CglkZWxldGUgYmFzZV9wdHI7CgoJcmV0dXJuIDA7Cn0=