food.as
来自「精通Actionscript 3.0 书籍源代码 非常实用」· AS 代码 · 共 36 行
AS
36 行
package zoo { // The Food class is the superclass of the various types of food that // pets eat. public class 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 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; } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?