重学一下设计的内容,这里说一下桥接模式
桥接模式的定义
将抽象部分与实现部分分离,使他们都可以独立地进行变化。
UML图
ConcretelmplementorA和ConcretelmplementorB:Implementor的具体实现,两者拥有相似的行为,都可以把行为抽象为Implementor的接口
Implementor:对ConcretelmplementorA/B行为的抽象接口,提供给外部调用。
Abstraction:抽象类,真正的桥,保存并持有Implementor的引用,调用Implementor的实现。
RefinedAbstraction:Abstraction的具体实现。