Translations of this page?:

static_cast

Syntax:

    TYPE static_cast<TYPE> (object);

The static_cast keyword can be used for any normal conversion between types. This includes any casts between numeric types, casts of pointers and references up the hierarchy, conversions with unary constructor, conversions with conversion operator. For conversions between numeric types no runtime checks if data fits the new type is performed. Conversion with unary constructor would be performed even if it is declared as explicit

It can also cast pointers or references down and across the hierarchy as long as such conversion is available and unambiguous. No runtime checks are performed.

Related Topics: const_cast, dynamic_cast, reinterpret_cast, A comparison of the C++ casting operators

 
• • • IndexRecent changesRSScc