结构型模式 桥接模式 将抽象和实现耦合,使得两者可以独立的变化。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 interface Implementor{ void doSomething(); void doAnything(); } class ConcreteImplementor1 implements Implementor{ public void doSomething(){ //具体业务处理 } public void doAnything(){ //具体业务处理 } } abstract class Abstraction{ private Implementor imp; public Abstraction(Implementor _imp){ imp = _imp; } //自身的行为和属性 public void request(){ imp.
首页 | 归档 | 体系 | 分享 | 阅读 | 友链 | 书签 | 教程 | 关于 |