Use super.methodName to call method in the super class : super « Class « Flash / Flex / ActionScript






Use super.methodName to call method in the super class

 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var rBunny:Rabbit = new Rabbit();
        rBunny.eat();
    }
  }
}

class Mammal {

    public function eat():void {
      trace("mammal");
    }

}

class Rabbit extends Mammal {

    public override function eat():void {
      super.eat();
      trace("rabbit");
    }

}

        








Related examples in the same category