php设计模式 Bridge (桥接模式)
2011-11-12 09:16
639 查看
简介:这是php设计模式 Bridge (桥接模式)的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。
class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=338992' scrolling='no'>
爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/338992.html pageNo:8
class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=338992' scrolling='no'>
1 <?php 2 /** 3 * 桥接模式 4 * 5 * 将抽象部份与它实现部分分离,使用它们都可以有独立的变化 6 */ 7 abstract class Implementor 8 { 9 abstract public function operation(); 10 } 11 12 class ConcreteImplementorA extends Implementor 13 { 14 public function operation() 15 { 16 echo "ConcreteImplementorA Operation<br/>"; 17 } 18 } 19 20 class ConcreteImplementorB extends Implementor 21 { 22 public function operation() 23 { 24 echo "ConcreteImplementorB Operation<br/>"; 25 } 26 } 27 28 class Abstraction 29 { 30 protected $_implementor = null; 31 32 public function setImplementor($implementor) 33 { 34 $this->_implementor = $implementor; 35 } 36 37 public function operation() 38 { 39 $this->_implementor->operation(); 40 } 41 } 42 43 class RefinedAbstraction extends Abstraction 44 { 45 } 46 47 class ExampleAbstraction extends Abstraction 48 { 49 } 50 51 // 52 $objRAbstraction = new RefinedAbstraction(); 53 $objRAbstraction->setImplementor(new ConcreteImplementorB()); 54 $objRAbstraction->operation(); 55 56 $objRAbstraction->setImplementor(new ConcreteImplementorA()); 57 $objRAbstraction->operation(); 58 59 $objEAbstraction = new ExampleAbstraction(); 60 $objEAbstraction->setImplementor(new ConcreteImplementorB()); 61 $objEAbstraction->operation();
爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/338992.html pageNo:8
相关文章推荐
- php设计模式 Bridge (桥接模式)
- [php]php设计模式 Bridge (桥接模式)
- php设计模式 Bridge (桥接模式)
- 桥接模式(Bridge )-设计模式(七)
- 设计模式(八)桥接模式(Bridge Pattern)
- C#设计模式之七桥接模式(Bridge Pattern)【结构型】
- 设计模式总结之Bridge Pattern(桥接模式)
- 设计模式学习笔记——桥接模式(Bridge Patten)
- 设计模式学习笔记十二:桥接模式(Bridge Pattern)
- java设计模式——桥接模式(Bridge Pattern)
- 浅谈JAVA设计模式之——桥接模式(Bridge)
- 设计模式-Bridge(桥接模式)
- [设计模式]Bridge桥接模式
- C#设计模式(八)桥接模式(Bridge Pattern)
- 设计模式学习笔记(八)——Bridge桥接模式
- 设计模式中结构型模式(二)桥接模式(Bridge)
- PHP设计模式——桥接模式
- 设计模式之桥接模式PHP实现
- 学习php设计模式 php实现桥梁模式(bridge)
- 设计模式之Bridge(桥接模式)