摘要: 原型模式适用于频繁产生某些类的对象,可以提升创建对象的性能,也使代码变得容易阅读。实现要点:1.定义一个接口Prototype,这个接口中定义一个clone方法。2.定义一个类并实现Prototype接口及clone方法。Java代码public interface Product extends Cloneable { void setSize(int size); int getSize();}public class Font implements Product{ int mSize; public Font(int size) { mSi... 阅读全文
posted @ 2013-12-22 21:58 adgkns 阅读(100) 评论(0) 推荐(0) 编辑