You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
桥梁模式
|
|
================
|
|
|
|
#### 描述:将类的功能层次结构与实现层次结构分离
|
|
|
|
bridge模式的作用就是将两样东西链接起来,它们分别是类的功能结构和类的是层次结构
|
|
|
|
类的功能层次结构:
|
|
1. 父类具有基本功能
|
|
2. 在子类新增功能
|
|
Display --> CountDisplay (类功能层次结构)
|
|
|
|
类的实现层次结构:
|
|
1. 父类声明抽象方法来定义接口
|
|
2. 子类通过实现具体方法来实现接口
|
|
DisplayImpl --> StringDisplayImpl (类的实现层次结构)
|
|
|
|
|