#include <iostream>
#include <typeinfo>
using namespace std;
class X { virtual void whatever(){}};
class Y : public X {public: int a;};
int main() {
try{
X* x = new X;
X* y = new Y;
Y &yy = dynamic_cast<Y&>(*x);
cout << yy.a;
} catch(std::exception& e) {cout << e.what() << endl;}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZWluZm8+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBYIHsgdmlydHVhbCB2b2lkIHdoYXRldmVyKCl7fX07CmNsYXNzIFkgOiBwdWJsaWMgWCB7cHVibGljOiBpbnQgYTt9OwoKaW50IG1haW4oKSB7CiAgICB0cnl7CiAgICAgIFgqIHggPSBuZXcgWDsKICAgICAgWCogeSA9IG5ldyBZOwogICAgICBZICZ5eSA9IGR5bmFtaWNfY2FzdDxZJj4oKngpOwogICAgICBjb3V0IDw8IHl5LmE7CiAgICB9IGNhdGNoKHN0ZDo6ZXhjZXB0aW9uJiBlKSB7Y291dCA8PCBlLndoYXQoKSA8PCBlbmRsO30KfQ==