#include <iostream>
using namespace std;
class Animal {
public:
Animal() {}
};
class Cat: public Animal {
public:
int someThing;
Cat(): Animal() {
this->someThing = 42;
}
};
int main() {
// Cat* a = new Cat(); // Works
Animal* a = new Cat(); // Does not work
cout << a->someThing << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgQW5pbWFsIHsKICBwdWJsaWM6CiAgQW5pbWFsKCkge30KfTsKCmNsYXNzIENhdDogcHVibGljIEFuaW1hbCB7CiAgcHVibGljOgogIGludCBzb21lVGhpbmc7CgkKICBDYXQoKTogQW5pbWFsKCkgewogICAgdGhpcy0+c29tZVRoaW5nID0gNDI7CiAgfQp9OwoKaW50IG1haW4oKSB7CiAgLy8gQ2F0KiBhID0gbmV3IENhdCgpOyAvLyBXb3JrcwogIEFuaW1hbCogYSA9IG5ldyBDYXQoKTsgLy8gRG9lcyBub3Qgd29yawogIGNvdXQgPDwgYS0+c29tZVRoaW5nIDw8IGVuZGw7CiAgCiAgcmV0dXJuIDA7Cn0=