Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created March 18, 2019 09:02
Show Gist options
  • Save monadplus/6fa17b75c9e669f77dc9b132e55f007f to your computer and use it in GitHub Desktop.
Save monadplus/6fa17b75c9e669f77dc9b132e55f007f to your computer and use it in GitHub Desktop.
Class: override impure val won't prevent side-effect
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