Created
June 17, 2011 16:42
-
-
Save gakuzzzz/1031777 to your computer and use it in GitHub Desktop.
Pimp my Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hirarie.scala.test | |
import java.awt.Point | |
class RichPoint(private val p: Point) { | |
def +(other: Point) = new Point(p.x + other.x, p.y + other.y) | |
} | |
object RichPoint { | |
implicit def pointToRichPoint(p: Point) = new RichPoint(p) | |
implicit def richPointToPoint(p: RichPoint) = p.p | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment