Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created March 11, 2015 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/638652ac905db0a8e291 to your computer and use it in GitHub Desktop.
Save shigemk2/638652ac905db0a8e291 to your computer and use it in GitHub Desktop.
class Foo(x: Int) {
val v = x
def +(y: Foo) = new Foo(v + y.v)
def less(y: Foo) = v < y.v
}
val a = new Foo(1) + new Foo(2)
val b = new Foo(1) less new Foo(2)
println(a.v) // 3
println(b) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment