zoukankan      html  css  js  c++  java
  • 外观模式【大话设计模式Demo】

    代码
    class FacadeDemo
    {
    static void Main()
    {
    Facade facade
    = new Facade();
    facade.MethodA();
    facade.MethodB();
    Console.Read();
    }

    }

    class subSystemOne
    {
    public void MethodOne()
    {
    Console.WriteLine(
    "子系统 方法一");
    }
    }

    class subSystemTwo
    {
    public void MethodTwo()
    {
    Console.WriteLine(
    "子系统 方法二");
    }
    }

    class subSystemThree
    {
    public void MethodThree()
    {
    Console.WriteLine(
    "子系统 方法三");
    }
    }

    class subSystemFour
    {
    public void MethodFour()
    {
    Console.WriteLine(
    "子系统 方法四");
    }
    }

    class Facade
    {
    subSystemOne one;
    subSystemTwo two;
    subSystemThree three;
    subSystemFour four;

    public Facade()
    {
    one
    =new subSystemOne();
    two
    =new subSystemTwo();
    three
    =new subSystemThree();
    four
    =new subSystemFour();
    }

    public void MethodA()
    {
    Console.WriteLine(
    "\n方法组A:");
    one.MethodOne();
    three.MethodThree();
    }

    public void MethodB()
    {
    Console.WriteLine(
    "\n方法组B: ");
    two.MethodTwo();
    four.MethodFour();
    }
    }

    外观模式 (Facade),为子系统中的一组接口提供一个一直的界面,此模式定义了一个高层接口,这个接口是的这一系统更加容易使用。

  • 相关阅读:
    Tina系统的安装
    检查有无相机的权限
    BarEasy打印小程序_CS
    js的websocket
    生成GUID
    读取excel数据到数据库里
    字符串trim
    使用 runOnUiThread在线程内更新UI
    PdfDocument生成PDF,总是产生空文件
    打印36进制的条码序列号
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/1706087.html
Copyright © 2011-2022 走看看