views:

67

answers:

1

Trying to find a straight answer for this. I am going to be creating some sub classes 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

+5  A: 

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
  }
}
Stefan
NB: You can override any non-private method or property that is not marked as `final`
Richard Szalay
Correct. Thanks for adding.
Stefan
Sweet, thanx thanks alot
numerical25
can you override event handlers ??
numerical25