-
-
Save jarhart/3021499 to your computer and use it in GitHub Desktop.
scala question about traits and parameter access
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
object Test { | |
var list = List() | |
} | |
abstract class Test(protected val parameter:String) { | |
} | |
trait TestTrait { self: Test => | |
Test.list = Test.list ++ List(parameter) | |
} | |
class SubTest extends Test("name") with TestTrait { | |
} | |
Test.list == List("name") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment