static cast

The static_cast operator is one of four new-style cast operators that were added to C++ in addition to c-style casts.

Syntax: static_cast(expr)

static_cast performs compile time checks that ensure the result of the cast will make sense. For instance, trying to static_cast a Base* to Derived* will generate a compile time diagnostic, while casting Derived* to Base* will not.

See Also: dynamic_cast, reinterpret_cast and const_cast