如果
AnInterface是Java,则可以使用SAM转换:
val impl = AnInterface { inst, num -> //...}否则,如果界面是Kotlin …
interface AnInterface { fun doSmth(inst: MyClass, num: Int)}…您可以使用
object语法匿名实现它:
val impl = object : AnInterface { override fun doSmth(inst:, num: Int) { //... }}


