<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## super * [引用一個方法或屬性的超類實現](http://www.kotlincn.net/docs/reference/classes.html#調用超類實現) * [在次構造函數中調用超類構造函數](http://www.kotlincn.net/docs/reference/classes.html#繼承) ### 調用超類實現 派生類中的代碼可以使用*super*關鍵字調用其超類的函數與屬性訪問器的實現: ``` open class Foo { open fun f() { println("Foo.f()") } open val x: Int get() = 1 } class Bar : Foo() { override fun f() { super.f() println("Bar.f()") } override val x: Int get() = super.x + 1 } ``` 在一個內部類中訪問外部類的超類,可以通過由外部類名限定的*super*關鍵字來實現:`super@Outer`: ``` class Bar : Foo() { override fun f() { /* …… */ } override val x: Int get() = 0 inner class Baz { fun g() { super@Bar.f() // 調用 Foo 實現的 f() println(super@Bar.x) // 使用 Foo 實現的 x 的 getter } } } ``` ### 示例 ~~~ fun main(args: Array<String>) { val son = Son("Harry") son.love() } open class Father { open val firstName = "Chen" open val lastName = "Jason" fun ff() { println("FFF") } } class Son : Father { override var firstName = super.firstName override var lastName = "Jack" constructor(lastName: String) { this.lastName = lastName } fun love() { super.ff() // 調用父類方法 println(super.firstName + " " + super.lastName + " Love " + this.firstName + " " + this.lastName) } } ~~~ 運行結果 ``` FFF Chen Jason Love Chen Harry ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看