开发者

overriding subclasses in actionscript

开发者 https://www.devze.com 2022-12-15 18:57 出处:网络
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, d

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

精彩评论

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

关注公众号