using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpDesignPattern.Facade
{
public class Chef
{
public void Cook()
{
Console.WriteLine("Cook");
}
}
public class Waiter
{
public void Order()
{
Console.WriteLine("order");
}
public void Serve()
{
Console.WriteLine("Serve...");
}
}
public class Cleaner
{
public void Clean()
{
Console.WriteLine("Cleaning...");
}
public void Wash()
{
Console.WriteLine("washing");
}
}
public class Facade
{
private VegVendor vendor;
private Chef chef;
private Waiter waiter;
private Cleaner cleaner;
public Facade()
{
this.vendor = new VegVendor();
vendor.Purchase();
this.chef = new Chef();
this.waiter = new Waiter();
this.cleaner = new Cleaner();
}
public void Order()
{
waiter.Order();
chef.Cook();
waiter.Serve();
cleaner.Clean();
cleaner.Wash();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpDesignPattern.Facade
{
public class VegVendor
{
public void Purchase()
{
Console.WriteLine("Supply the vegatable");
}
}
public class Helper
{
public void Cook()
{
Console.WriteLine("Cook...");
}
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。