Created
October 17, 2014 04:04
-
-
Save paulp/e2e1894ddf66cb6d8f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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