GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaCodeAcc/src/designpattern/bridge/BridgeClient.java at master · echoTheLiar/JavaCodeAcc Expand file tree/ Copy pathBridgeClient.javaMore file actions 29 lines (24 loc) · 699 Bytes / Copy pathBridgeClient.javaFile metadata and controls29 lines (24 loc) · 699 Bytes 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 package designpattern.bridge; /** * 客户端 * * @author liu yuning * */ public class BridgeClient { public static void main(String[] args) { Abstraction a = new AbstractionA("A"); a.setImplementor(new ConcreteImplemtorA()); a.operation(); a.setImplementor(new ConcreteImplemtorB()); a.operation(); Abstraction b = new AbstractionB("B"); b.setImplementor(new ConcreteImplemtorA()); b.operation(); b.setImplementor(new ConcreteImplemtorB()); b.operation(); // 这样通过使用“组合/聚合复用原则” // 如果继续有AbstractionC ... 或者ConcreteImplemtorC ... // 只需要扩展类即可,不需要修改现有类,符合“开放-封闭”原则 } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |