B. Stroustrup originally designed C++ to not have dynamic_cast
but then there was something that people had to add that cast to the language. Wherever I met usage of dynamic_cast
it was against polymorphic usage of objects. So it turns sometimes you will prefer to know the object type instead of trying to re-design your code to utilize polymorphism? What cases are those? Can you give even one example?
P.S. Please consider that dynamic_cast
adds lots of RTTI info into the code which is partial reflection added to the language as the class hierarchy information is stored in the compiled code. This is against C++ philosophy - you pay for the things you use. (I know you can turn off RTTI but by default it is on and you may not need it in your whole code not a single time!)
EDIT: According to @Griwes's comments turning of RTTI is possible but it is undefined behavior. For this reason the conclusion above related to C++ philosophy becomes much stronger.