外观模式:

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

读书笔记-外观模式又叫门面模式


四个子系统的类

class SubSystemOne{

  public void MethodOne(){

      System.err.println("子系统方法一");

   }

}

class SubSystemTwo{

   public void MethodTwo(){

       System.err.println("子系统方法二");

    }

}

class SubSystemThree{

  public void MethodThree(){

     System.err.println("子系统方法三");

   }

}

class SubSystemFour{

  public void MethodFour(){

     System.err.println("子系统方法四");

   }

}

外观类

class Facede

{

   SubSystemOne one;

   SubSystemTwo two;

   SubSystemThree three;

   SubSystemFour four;

   public Facede(){

     one = new SubSystemOne();

     two = new SubSystemTwo();

    three = new SubSystemThree();

    four = new SubSystemFour();

  }

...

  

}




相关文章:

  • 2021-05-31
  • 2021-04-10
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-31
  • 2021-12-23
  • 2021-10-26
  • 2021-04-04
  • 2021-04-17
相关资源
相似解决方案