Created
August 28, 2015 07:58
-
-
Save shigemk2/30532a79ebcbfc54b9dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
class B | |
def f(b: B) = println("Got my B!") | |
} | |
val a1 = new A | |
println(a1) | |
val a2 = new A | |
println(a2) | |
a2.f(new a2.B) | |
// a2.f(new a1.B) |
This file contains hidden or 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 { | |
class B | |
def f(b: B) = println("Got my B!") | |
def g(b: A#B) = println("Got a B.") | |
} | |
val a1 = new A | |
println(a1) | |
val a2 = new A | |
println(a2) | |
a2.f(new a2.B) | |
// a2.f(new a1.B) // error: type mismatch | |
a2.g(new a1.B) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment