Created
December 4, 2013 19:18
-
-
Save quii/7793720 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
trait MyTrait{ | |
def say: String | |
} | |
trait ConcreteTrait extends MyTrait{ | |
def say = "Hello, world" | |
} | |
trait TestTrait extends MyTrait{ | |
def say = "Testing" | |
} | |
class Foo{ | |
this: MyTrait => | |
println(say) | |
} | |
val x = new Foo // compilation error | |
val y = new Foo with ConcreteTrait // works | |
val test = new Foo with TestTrait // for testing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment