topical media & game development

talk show tell print

actionscript-zoo-lib-Food.ax

actionscript-zoo-lib-Food.ax [swf] flex


  package  {
    // The @ax-actionscript-zoo-lib-Food class is the superclass of the various types of food that 
    // pets eat.
    public class @ax-actionscript-zoo-lib-Food {
      // Tracks the number of calories this piece of food has
      private var calories:int;
      //  This piece of food's human readable name
      private var name:String;
      
      // Constructor
      public function @ax-actionscript-zoo-lib-Food (initialCalories:int) {
        // Record the specified initial number of calories
        setCalories(initialCalories);
      }
      
      // Returns the number of calories this piece of food has
      public function getCalories ():int {
        return calories;
      }
      
      // Assigns the number of calories this piece of food has
      public function setCalories (newCalories:int):void {
        calories = newCalories;
      }
      
      // Returns this piece of food's human readable name
      public function getName ():String {
        return name;
      }
      
      // Assigns this piece of food's human readable name
      public function setName (newName:String):void {
        name = newName;
      }  
    }
  }
  


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.