Casting: static vs dynamic
A static_cast takes place at the compilation stage and can prevent compilation errors, but this can result in meaningless runtime events in the context of the wrong object referencing.
The static_cast does not ensure type safety.
The dynamic_cast operator provides a mechanism for testing at runtime whether an object-based cast causes problems.
We know that a base class pointer can point to objects of any derived class.
The dynamic_cast is useful to identify which type, which derived class, of object is pointed to by the base class pointer.