struct A {}; struct B : A {}; int main() { A* a = new B(); B* b = dynamic_cast<B*>(a); }
Standard input is empty
prog.cpp: In function ‘int main()’:
prog.cpp:9:30: error: cannot dynamic_cast ‘a’ (of type ‘struct A*’) to type ‘struct B*’ (source type is not polymorphic)
B* b = dynamic_cast<B*>(a);
^
Standard output is empty