Types belonging to the same category as well as different currencies can be converted to each other. Type conversion (typecasting) is the process of converting (converting) a value of one type to a value of another type.
Type conversions are divided into explicit and implicit conversions.
Implicit conversions do not require any language constructs and do not lead to data loss.
An example of an implicit conversion is converting a value of type
int to type
double. Being a 64-bit real type,
double can store any value of a 32-bit integer type
As shown in the image above, converting an int to a double does not result in data loss, since a 32-bit value fits into 64 bits.
Explicit conversions, often referred to as typecasting for clarity, take place with developer input and require the specification of language constructs called cast operators. Typecasting is required when data may be lost during the conversion process or, for some reason, the process may end with an error. The simplest example of an explicit conversion is the conversion of the double type, used to store 64-bit floating point values, to the integer type int.
Thanks goes to these wonderful people (emoji key):