Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Created June 17, 2011 16:42
Show Gist options
  • Save gakuzzzz/1031777 to your computer and use it in GitHub Desktop.
Save gakuzzzz/1031777 to your computer and use it in GitHub Desktop.
Pimp my Library
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