Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Language/Type/Conversion/Casting

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

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)