Using Static Methods and Properties : Static : Class Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Class » Static »

 

Using Static Methods and Properties


 
  
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var eighteenSpeed:Bicycle = new Bicycle(18);
        var fixedGear:Bicycle = new Bicycle(1);
        
        trace(eighteenSpeed.gears)//18
        trace(fixedGear.gears)//1


    }
  }
}
    class Bicycle
    {
        private var _gears:Number;
        public function get gears():Number
        {
            return _gears;
        }

    public function Bicycle(numberOfGears:Number)
    {

            this._gears = numberOfGears;
        }
    }

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Class
» Static