Created
April 28, 2016 08:44
-
-
Save songfei1983/9b3de56ad41ec1db24362d6afd971053 to your computer and use it in GitHub Desktop.
traitは線形だね ref: http://qiita.com/songfei1983/items/e2de97a63d88f8b4f9ab
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
trait A { | |
def foo = println("I am A." + super.toString) | |
} | |
trait B extends A { | |
override def foo = { | |
println("I am B." + super.toString) | |
super.foo | |
} | |
} | |
trait C extends A { | |
override def foo = { | |
println("I am C." + super.toString) | |
super.foo | |
} | |
} | |
object D extends A with B with C { | |
def fooo = { | |
println("I am D." + super.toString) | |
foo | |
} | |
} | |
D.fooo | |
// I am D.$line43.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$D$@4aa7bb1b | |
// I am C.$line43.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$D$@4aa7bb1b | |
// I am B.$line43.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$D$@4aa7bb1b | |
// I am A.$line43.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$D$@4aa7bb1b | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment