gpt4 book ai didi

javascript - Kotlin 中具有属性的函数类型

转载 作者:行者123 更新时间:2023-11-30 14:50:43 25 4
gpt4 key购买 nike

我可以在 TypeScript 中指定它(因此可以在 JavaScript 中完成):

interface Foo {
(arg: any): void
foo: string
}

在 Kotlin 中可以实现同样的事情吗?

最佳答案

这也可以用 Kotlin 表达:

interface Foo {
fun funX(arg: Any): Unit
val foo: String
}

Properties in Interfaces

关于javascript - Kotlin 中具有属性的函数类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48143496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com