C++ Language/Type/Conversion/Coercion

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A math operation can only be applied to two operands of the same type. If they are not already of the same type, then one of them will need to be "coerced" (if possible, the compiler automatically inserts an implicit type-conversion that changes a value's representation from one type to another).

Additional information about coercion (includes interactive examples)