【发布时间】:2019-01-18 14:30:15
【问题描述】:
界面如下:
interface SomeInterface {
companion object {
const val MY_CONST = "the constant"
}
}
然后,类(没有正文,因为只是一个例子):
class SomeClass : SomeInterface
之后,当我尝试通过 SomeClass 调用常量时,它不允许我:
SomeClass.MY_CONST
我该如何解决这个问题?
【问题讨论】:
标签: inheritance interface kotlin companion-object