我在超类中覆盖了一个方法ini,但奇怪的是超级类中的ini方法仍被调用,虽然我没有使用super调用它
有什么想法吗?这是haxe 3中的一个问题吗? p.s:它是一个OpenFL项目,针对flash ..
class superClass{
function ini():Void
{
// this line should not be reached, but, it is reached .. !
}
}
class subClass extends superClass{
override function ini():Void
{
// I Am not calling super ini here ..
}
}
修改
以下是我的代码摘要,您可以在其中查看我的类集:
class EComponent extends Sprite
{
}
class Component extends EComponent
{
public function new(aBoard:Board)
{
ini();
}
function ini():Void
{
// I am checking this manually,
// because ini is called even though its BeziereWire instance!
if (Std.is(this, BeziereWire))
return;
}
function iniRotators():Void
{
}
}
class BeziereWire extends Component
{
override function ini():Void
{
iniRotators();
}
}
答案 0 :(得分:3)
这是一个截图: