Kotlin interface

58 阅读1分钟
Kotlin interface
  • interface

使用场景:流媒体传输和接收

interface GmailInterface {
    var message:Any
    fun sendMail(msm:Any)
    fun receiveMail(msm:Any)
}
  • GmailManager
class GmailManager:GmailInterface {
    override var message: Any = ""
        get() = { receiveMail(field)}
        set(value) {
            sendMail(value)
        }

    override fun sendMail(msm:Any) {
        TODO("Not yet implemented")
    }

    override fun receiveMail(msm:Any) {
        TODO("Not yet implemented")
    }
}

thank..