What are conversion rules?

Implicit conversion

  • Operators Delete without losing info Follow conversion hierachy - What is conversion hierachy? e.g. 2 / 5.0 -> 0.4 (2 promoted to 2.0)

  • Assignment Promoted / demoted based on variable type int myInt; myInt = 0.4; // 0 stored instead

    double myDouble; myDouble = 5; // myDouble stores 5.0

Explicit conversion

  • Typecasting (double) 2 / 5 -> 0.4