嵌套类

类可以嵌套在另一个类当中。

class Outer {
    private val bar: Int = 1
    class Nested {
        fun foo() = 2
    }
}
val demo = Outer.Nested().foo()

results matching ""

    No results matching ""