21 lines
532 B
Java
21 lines
532 B
Java
package cn.bunny.pattern5.demo2;
|
|
|
|
import cn.bunny.pattern5.demo2.command.BakeChickenWingCommand;
|
|
import cn.bunny.pattern5.demo2.command.BakeMuttonCommand;
|
|
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
Cook cook = new Cook();
|
|
Waiter waiter = new Waiter();
|
|
|
|
// 来点烤鸡翅
|
|
waiter.addCommand(new BakeChickenWingCommand(cook));
|
|
|
|
// 点烤羊肉串
|
|
waiter.addCommand(new BakeMuttonCommand(cook));
|
|
|
|
// 通知厨师去做
|
|
waiter.notifyCook();
|
|
}
|
|
}
|