Created
March 18, 2019 09:02
-
-
Save monadplus/6fa17b75c9e669f77dc9b132e55f007f to your computer and use it in GitHub Desktop.
Class: override impure val won't prevent side-effect
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
class Foo { | |
val x = println("Foo") | |
} | |
class Bar(override val x: Unit) extends Foo | |
new Bar(()) // Foo is printed | |
// res1: Bar = ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment