class MyOwnCoffee
{
public static void main(String[] args) {
Coffee myCoffee = makeMyCoffee();
enjoyTea(myCoffee);
}
//① 반환형(Return type)과 반환값(Return value) 주목!
private Drink makeMyCoffee() {
int tumblerSize = 420;
int waterRatio = 3;
int coffeeRatio = 1;
return new Coffee(tumblerSize, waterRatio, coffeeRatio);
}
//② 매개변수 형(Parameter type) 주목!
private void enjoyTea(Tea tea) {
Coffee myCoffee = (Coffee) tea; //③ Down casting!
myCoffee.makeCoffee();
do {
myCoffee.sip();
if(myCoffee.empty()) {
myCoffee.refill();
break;
}
}
while(true);
}
}