外观模式,先占位,由于文章太耗时,后面补上。
using System;
using System.Collections.Generic;
namespace SimpleFactory
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("有客人来啦");
服务员 waiter = new 服务员();
waiter.接待();
}
}
public class 服务员
{
public void 接待()
{
系统控制中心 controller = new 系统控制中心();
controller.Do();
}
}
public class 系统控制中心
{
private 订单打印 _订单打印 = new 订单打印();
private 材料准备 _材料准备 = new 材料准备();
private 大厨做菜 _大厨做菜 = new 大厨做菜();
private 出餐播报 _出餐播报 = new 出餐播报();
public void Do()
{
this._订单打印.Do();
this._材料准备.Do();
this._大厨做菜.Do();
this._出餐播报.Do();
}
}
public class 订单打印
{
public void Do()
{
Console.WriteLine("打印客人订单");
}
}
public class 材料准备
{
public void Do()
{
Console.WriteLine("准备食材");
}
}
public class 大厨做菜
{
public void Do()
{
Console.WriteLine("大厨烧菜");
}
}
public class 出餐播报
{
public void Do()
{
Console.WriteLine("21号,请您用餐");
}
}
}