概念:
举例:
总结:
代码:
namespace 外观模式
{
class Program
{
static void Main(string[] args)
{
Facade facade = new Facade();
facade.MethodA();
facade.MethodB();
Console.Read();
}
}
public class Facade
{
SubSystemA a = new SubSystemA();
SubSystemB b = new SubSystemB();
SubSystemC c = new SubSystemC();
public void MethodA()
{
a.MethodA();
b.MethodB();
}
public void MethodB()
{
b.MethodB();
c.MethodC();
a.MethodA();
}
}
class SubSystemA
{
public void MethodA()
{
Console.WriteLine("SubSystemA.MethodA");
}
}
class SubSystemB
{
public void MethodB()
{
Console.WriteLine("SubSystemB.MethodB");
}
}
class SubSystemC
{
public void MethodC()
{
Console.WriteLine("SubSystemC.MethodC");
}
}
}