开发者

overriding subclasses in actionscript

Trying to find a straight answer for this. I am going to be creating some sub classe开发者_开发知识库s in actionscript 3. I was wanting to know if it is possible to override the parent class. If so, do I need to put a override assigner on the parent class method or what.

Thanks guys


You can override any non-private method in your subclass.

And there is no keyword to indicate in the base class whether a method can or has to be overridden (like virtual in C++).

E.g.

public class A
{
  public function methodOfA():void
  {
  }
}

public class B extends A
{
  override public function methodOfA():void
  {
    // do something more specific to B
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜