-
-
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
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
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