Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
You can’t perform that action at this time.