Chapter 4 Example 2

by actionscriptbible
♥0 | Line 17 | Modified 2009-08-13 10:12:07 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ddFm
 */

package {
  import com.actionscriptbible.Example;
  import com.actionscriptbible.ch4.Seagull;
  import com.actionscriptbible.ch4.SoccerSeagull;
  
  public class ch4ex2 extends Example {
    public function ch4ex2() {
      var gull:Seagull = new Seagull();
      gull.eat();
      gull.eat();
      gull.eat();
      gull.eat();
      trace("The parent seagull's weight is", gull.weight); //4
      
      var childGull:SoccerSeagull = new SoccerSeagull();
      trace("The child seagull's weight is", childGull.weight); //2
    }
  }
}