[php]php设计模式 Prototype (原型模式)

摘要: 1 <?php 2 /** 3 * 原型模式 4 * 5 * 用原型实例指定创建对象的种类.并且通过拷贝这个原型来创建新的对象 6 * 7 */ 8 abstractclass Prototype 9 {10 private$_id=null;11 12 publicfunction __construct($id)13 {14 $this->_id =$id;15 }16 17 publicfunction getID()18 {19 return$this->_id;20 }21 22 publicfunction __clone() //... 阅读全文
posted @ 2011-06-25 22:54 bluefrog 阅读(1390) 评论(0) 推荐(0)