Skip to content

Instantly share code, notes, and snippets.

@davebren
Created March 11, 2016 06:19
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 davebren/aba529ff8512e588e15a to your computer and use it in GitHub Desktop.
Save davebren/aba529ff8512e588e15a to your computer and use it in GitHub Desktop.
Override lazy val in kotlin subclass and call it from the super class constructor
open class A {
open protected fun x(): Int = 5
val x: Int by lazy { x() }
}
class B: A() {
override fun x(): Int = 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment