Occasionally, you need to convert an object from one type to an object of a different type. For example, I’m sure you’ve had to convert a
Byte to an
Int32 at some point in your life. When the source type and the target type are a compiler’s primitive types, the compiler knows how to emit the necessary code to convert the object.
However, if neither type is one of the compiler’s primitive types, the compiler won’t know how to perform the conversion. For example, imagine that the FCL included a
Rational data type. It might be convenient to convert an
Int32 object or a
Single object to a
Rational object. Moreover, it also might be nice to convert a
Rational object to an
Int32 or a
To make these conversions, ...