We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a838bfb commit ecd4ccaCopy full SHA for ecd4cca
patterns/src/main/kotlin/io/nullables/api/playground/patterns/parent_call/Greeting.kt
@@ -0,0 +1,23 @@
1
+package io.nullables.api.playground.patterns.parent_call
2
+
3
+class Greeting(val word: String)
4
5
+open class Father {
6
+ init {
7
+ sayGreeting()
8
+ }
9
10
+ open fun sayGreeting() = println("Luke! I'm your Father!!!")
11
+}
12
13
+class Leia : Father() {
14
+ private var greeting: Greeting? = null
15
+ get() {
16
+ if (field == null) {
17
+ field = Greeting("I love you!")
18
19
+ return field
20
21
22
+ override fun sayGreeting() = println(greeting!!.word)
23
0 commit comments