How to use Kotlin's invoke operator to get a receiver on object instantiation

后端 未结 0 1458
轻奢々
轻奢々 2020-12-13 14:05
class Family() {
    fun addMember(name: String) {}

    inline operator fun invoke(body: Family.() -> Unit) {
        body()
    }
}

After using

相关标签:
回答
  • 消灭零回复
提交回复
热议问题