Skip to content

Instantly share code, notes, and snippets.

@paulp
Created October 17, 2014 04:04
Show Gist options
  • Save paulp/e2e1894ddf66cb6d8f6d to your computer and use it in GitHub Desktop.
Save paulp/e2e1894ddf66cb6d8f6d to your computer and use it in GitHub Desktop.
class A { def f(x: Int, y: Int) = ((x, y)) }
class B extends A { override def f(y: Int, x: Int) = ((y, x)) }
object Test {
val b = new B
def main(args: Array[String]): Unit = {
println((b: A).f(x = 1, y = 2)) // (1,2)
println((b: B).f(x = 1, y = 2)) // (2,1)
println((b: A).f(1, 2)) // (1,2)
println((b: B).f(1, 2)) // (1,2)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment