Skip to content

Instantly share code, notes, and snippets.

@micseydel
Created November 4, 2019 17:16
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 micseydel/3e70496371588524d76f6b0cc0e4263c to your computer and use it in GitHub Desktop.
Save micseydel/3e70496371588524d76f6b0cc0e4263c to your computer and use it in GitHub Desktop.
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