【发布时间】:2016-10-29 17:09:52
【问题描述】:
我有课
open class Texture
我想定义equals(other: Texture) 运算符
operator fun equals(other: Texture) = ...
但我明白了
Error:(129, 5) Kotlin: 'operator' 修饰符不适用于此函数:必须覆盖 Any 中的 ''equals()''
什么意思?
如果我把它改成
operator fun equals(other: Any) = ...
意外覆盖,两个声明具有相同的 jvm 签名
【问题讨论】:
标签: operator-overloading kotlin