Cast Operator

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]

*Explicit conversions are possible using the unary cast operator which consists of a type name in parentheses.
 
*Example 5: (int) 1e6d
Converts a value of type double to an int.
 
*Note that not only meaningful conversions are permitted. (bool) 3 is, for example, not permitted.
 
*Numerical conversions may cause loss of precision or, in case of a narrowing conversion, even a different sign and a overall loss of information.
 
*A cast operator cannot be used as a replacement to the + operator to convert arbitrary types into a string representation.
 

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]
Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002