Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Created October 15, 2012 03:08
Show Gist options
  • Save gakuzzzz/3890643 to your computer and use it in GitHub Desktop.
Save gakuzzzz/3890643 to your computer and use it in GitHub Desktop.
final な override ?
class A {
final def foo(x: Int, y: Int): Int = x + y
def useFoo = {
println(foo(100, 200))
}
}
class B extends A {
val foo: (Int, Int) => Int = (x, y) => -super.foo(x, y)
}
scala> val b = new B
b: B = B@195648f
scala> b.useFoo
300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment