diff --git a/notes/pics/dp-composite.png b/notes/pics/dp-composite.png new file mode 100644 index 00000000..c87d76ac Binary files /dev/null and b/notes/pics/dp-composite.png differ diff --git a/notes/设计模式 - 组合.md b/notes/设计模式 - 组合.md index fd78f25a..71975fb9 100644 --- a/notes/设计模式 - 组合.md +++ b/notes/设计模式 - 组合.md @@ -1,19 +1,16 @@ ## 组合(Composite) -### Intent - +### 意图 将对象组合成树形结构来表示“整体/部分”层次关系,允许用户以相同的方式处理单独对象和组合对象。 -### Class Diagram - +### 类图 组件(Component)类是组合类(Composite)和叶子类(Leaf)的父类,可以把组合类看成是树的中间节点。 组合对象拥有一个或者多个组件对象,因此组合对象的操作可以委托给组件对象去处理,而组件对象可以是另一个组合对象或者叶子对象。 -