Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Implicit conversions are considered in three distinct situations:
If the type of an expression differs from the expected type:
sqrt(Fraction(1, 4)) // Calls fraction2Double since sqrt expects a Double
If an object accesses a nonexistent member:
new File("README").read
// Calls file2RichFile since File has no read methodIf an object invokes a method whose parameters don’t match the given arguments:
3 * Fraction(4, 5) // Calls int2Fraction since the * method of Int doesn't accept a Fraction