外观模式

  • 外观模式通过定义一个一致的接口,用以屏蔽内部子系统的细节
  • 使得调用端只需跟这个接口发生调用,而无需关心这个子系统的内部细节

代码实现

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Family{
static main():void{
const father = new Father()
const child = new Father()
father.work();
child.study()
}
}
class Father {
work(){}
}
class Child{
study(){}
}

参考链接