#include <iostream>
#include <exception>
usingnamespace std;
class X { virtualvoid whatever(){}};
class Y : public X {public: int a;};
int main() {
try{
X* x = new X;
X* y = new Y;
Y* yy;
yy = dynamic_cast<Y*>(x);
cout << yy->a;
} catch(exception& e) {cout << e.what() << endl;}
}