我正在使用Swift语言在macOS项目中开发,但是在我编写的几个类中,重载变量一直是一个困扰我的问题。在classTwo
中,Xcode提示错误:Cannot override with a stored property 'texture'
,该错误出现在以下行:
override var texture: SKTexture?
这是我所使用的一部分代码。
public class classOne: SKSpriteNode {
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// Other functions
}
第二类;
class classTwo: classOne {
override var texture: SKTexture? // Cannot override with a stored property 'texture'
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// Some other functions
}
我计划为classTwo
定义一个特定的纹理,但目前我甚至无法使其正常工作。提前致谢,如果有任何帮助解决此问题的建议将不胜感激!
super.
(包括.
)以便阅读。 - mfaani