Kotlin: Interface … does not have constructors

前端 未结 7 1170
长情又很酷
长情又很酷 2020-12-04 16:14

I am converting some of my Java code to Kotlin and I do not quite understand how to instantiate interfaces that are defined in Kotlin code. As an example, I have an interfac

7条回答
  •  不知归路
    2020-12-04 16:45

    Try to access to your interface like this :

     object : MyInterface {
        override fun onSomething() { ... }
    }
    

提交回复
热议问题