728x90
반응형
SMALL
어느 아내가 프로그래머 남편에게
「쇼핑하러 갈 때, 우유 하나 사와. 아, 계란 있으면 6개 사와」
남편은 잠시 후, 우유를 6개 사왔다.
============================================================
class Husband extends Programmer
{
public static function getInstance():Husband
{
//...
}
public function gotoAndShopping(shop:IShop):void
{
//...
}
public function giveMilkToMe(count:uint):Milk
{
var mart:IShop = ShopList.get(0);
this.gotoAndShopping(mart);
if(uint(Math.random() * 100) % 2 == 0)
{
return null;
}
var milk:Milk = new Milk();
milk.get( ((mart.exists(EGG))? 6 : count) );
return milk;
}
}
var h:Husband = Husband.getInstance();
trace(h.giveMilkToMe(1));// 6
h = new Husband();
728x90
반응형
LIST