我有一个类问题定义equals()方法操作
open class Texture
,我想定义equals(other: Texture)
操作
operator fun equals(other: Texture) = ...
,但我得到
Error:(129, 5) Kotlin: 'operator' modifier is inapplicable on this function: must override ''equals()'' in Any
什么这是什么意思?
如果我改变,要
operator fun equals(other: Any) = ...
Accidental override, two declarations have the same jvm signature
更新了答案,由于问题的更新。 – hotkey
当'other'不是'Texture'的实例时,如何安排函数返回'false'? – saulspatz