class predek { public: virtual ~predek(){} };
class potomek: public predek { };


predek* p1 = new potomek;
predek *p2 = new predek;


potomek* pp1 = dynamic_cast<potomek*>(p1);
if(pp1) { // ...


potomek* pp2 = dynamic_cast<potomek*>(p2);
if(pp2) { // ...
