Skip to content

Instantly share code, notes, and snippets.

@quii
Created December 4, 2013 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quii/7793720 to your computer and use it in GitHub Desktop.
Save quii/7793720 to your computer and use it in GitHub Desktop.
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