error: expected unqualified-id before ‘dynamic_cast’

Error code:

Deride * q= std::dynamic_cast<Deride*>(p);

Dynamic_cast is not part of STD library, but C++ keyword, so it should be removed.

Deride * q= dynamic_cast<Deride*>(p);

A word of caution:
STD :: Dynamic_pointer_cast for dynamic conversion shared_PTR is the part in STD. This is also obvious because shared_PTR is a part in STD

Read More: