Created
November 4, 2019 17:16
-
-
Save micseydel/3e70496371588524d76f6b0cc0e4263c 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 A { | |
val foo: Int = { | |
println("A.foo") | |
1 | |
} | |
println(s"foo on construction: $foo") | |
} | |
class B extends A { | |
override val foo = 2 | |
} | |
new B | |
/* | |
Result: | |
A.foo | |
foo on construction: 0 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment