override method from parent class : Override : Class Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Class » Override »

 

override method from parent class


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        
        var c:Cat = new Cat();
        c.speak("Miao");
    }
  }
}
     class Animal {
          public function Animal() {
          }
          public function speak(sound:String):void {
               trace(sound);
          }
     }
     class Cat extends Animal {
          public function Cat() {
          }
          public override function speak(sound:String):void {
               for (var i:uint=0; i < 100; i++) {
                    super.speak("Meow! Meow! Meow!");
               }
          }
     }

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Class
» Override