mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-10-28 02:43:08 +08:00
* refactor: clean to roadmap content * refactor: move shared helpers into scripts/lib
541 B
541 B
Dynamic Cast
dynamic_cast is a C++ casting operator primarily used within polymorphic class hierarchies to safely convert pointers or references from a base class to a derived class. Unlike static casts, it performs a runtime check to ensure the validity of the conversion. If the object being cast is not actually an instance of the target derived class, dynamic_cast returns a null pointer (for pointer casts) or throws a std::bad_cast exception (for reference casts), preventing undefined behavior and enabling safer downcasting.