C++ Language/Type/Conversion/Casting
A "type cast" is a manually-programmed expression of type-conversion.
Traditional C programs wrote casting as (float)iVar
.
C++ programs write casting as static_cast<float>(iVar)
.
When casting from a pointer-to-base-class into a pointer-to-derived-class, using dynamic_cast<>
instead of static_cast<>
adds a runtime check which returns NULL
if the pointed-at object wasn't actually an instance of that derived class.
Additional information about casting (includes interactive examples)