title: Derived class initialisation order
body: <p>I'm currently working my way through the Kotlin docs for this section where they cover <a href="https://kotlinlang.org/docs/reference/classes.html#derived-class-initialization-order" rel="nofollow noreferrer">Derived class initialization order</a>.</p>
  
  <p>For the following snippet...</p>
  
  <pre><code>open class Base(val name: String) {
  
    init { println("Initializing Base") }
  
    open val size: Int = name.length.also { println("Initializing size in Base: $it") }
  }
  
  class Derived(
      name: String,
      val lastName: String
    ) : Base(name.capitalize().also { println("Argument for Base: $it") }) {
  
    init { println("Initializing Derived") }
  
    override val size: Int =
      (super.size + lastName.length).also { println("Initializing size in Derived: $it") }
  }
  
  fun main(args: Array&lt;String&gt;) {
    println("Constructing Derived(\"hello\", \"world\")")
    val d = Derived("hello", "world")
  }
  </code></pre>
  
  <p>when executed it prints this:</p>
  
  <p><code>Constructing Derived("hello", "world")
  Argument for Base: Hello
  Initializing Base
  Initializing size in Base: 5
  Initializing Derived
  Initializing size in Derived: 10</code></p>
  
  <p>My question is, why when <code>override val size: Int = (super.size + lastName.length).also { println("Initializing size in Derived: $it") }</code>
  is executed does it not print <code>Initializing size in Base: 5</code> again?</p>
  
  <p>I would have thought it would print something like this:</p>
  
  <p><code>Constructing Derived("hello", "world")
  Argument for Base: Hello
  Initializing Base
  Initializing size in Base: 5
  Initializing Derived
  Initializing size in Base: 5 // Print because .also is called again ?
  Initializing size in Derived: 10
  </code></p>