equal
deleted
inserted
replaced
432 // late extension problem; namely, given a class C and a class T, |
432 // late extension problem; namely, given a class C and a class T, |
433 // how to have C extend T without touching or recompiling C. |
433 // how to have C extend T without touching or recompiling C. |
434 // Conversions add a wrapper when a member of T is requested |
434 // Conversions add a wrapper when a member of T is requested |
435 // from an instance of C. |
435 // from an instance of C. |
436 |
436 |
437 //Another example |
437 //Another example (TimeUnit in 2.13?) |
438 |
438 |
439 case class Duration(time: Long, unit: TimeUnit) { |
439 case class Duration(time: Long, unit: TimeUnit) { |
440 def +(o: Duration) = Duration(time + unit.convert(o.time, o.unit), unit) |
440 def +(o: Duration) = Duration(time + unit.convert(o.time, o.unit), unit) |
441 } |
441 } |
442 |
442 |