摘要: 适配器模式定义:Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatile interfaces.将一个类的接口变成客户端所期待的另一中接口,从而使原本因接口不匹配而无法在一起工作的两个类能够在一起工作。其中用到适配器模式的经典例子就是 阅读全文
posted @ 2013-01-06 22:52 叶梅树 阅读(5117) 评论(4) 推荐(3) 编辑
摘要: 组合模式定义:Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.将对象组合成树形结构以表示“部分-整体”的层次结构,使得用户对单个对象和组合对象的使用具有一致性。 如上图所示 阅读全文
posted @ 2013-01-06 10:11 叶梅树 阅读(2791) 评论(0) 推荐(0) 编辑