WonHada.com으로 이전

쇼핑하러 갈 때, 우유 하나 사와. 아, 계란 있으면 6개 사와 본문

낙서장

쇼핑하러 갈 때, 우유 하나 사와. 아, 계란 있으면 6개 사와

반주부 2012. 8. 14. 17:29
반응형

어느 아내가 프로그래머 남편에게 

「쇼핑하러 갈 때, 우유 하나 사와. 아, 계란 있으면 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();

반응형