dynamic_cast performs a run-time checked conversion from a polymorphic base-class pointer or reference to a derived-class pointer or reference. The base class needs at least one virtual method so the run-time type can be identified. section 5.6
Mistake: treating a base pointer as a derived object without checking. A pointer cast can yield null when the objects are incompatible; a failed reference cast throws an exception. An unchecked or unsuitable cast can compile successfully yet fail during execution. section 5.6
Check the downcast
With polymorphic B and derived D, use D* d = dynamic_cast<D*>(b); then test d before calling derived behavior. If b does not actually refer to D, handle the incompatible downcast instead of dereferencing a null pointer. Prefer redesigning toward polymorphic behavior when possible. section 5.6

