8c1c9f5660
Constructors of inner classes already have access to their outer class through its dispatch receiver parameter.
21 lines
366 B
Kotlin
21 lines
366 B
Kotlin
class Outer(val x: Int) {
|
|
inner class Inner() {
|
|
inner class InnerInner() {
|
|
|
|
init {
|
|
println(x)
|
|
}
|
|
|
|
lateinit var s: String
|
|
|
|
constructor(s: String) : this() {
|
|
this.s = s
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
fun main(args : Array<String>) {
|
|
Outer(42).Inner().InnerInner("zzz")
|
|
}
|