Type Casting
(Explicit Coercion)
• A C++ cast operation consists of a data type name
and then, within parentheses, the expression to be
converted:
someFloat = float (3 * someInt + 2);
someInt = int (5.2 / someFloat –
anotherFloat);
• Countless errors have resulted from unintentional
mixing of types.
• It’s possible to mix data types within an
expression.