名称 Composite
结构  设计模式——复合模式
意图 将对象组合成树形结构以表示“部分-整体”的层次结构。C o m p o s i t e 使得用户对单个对象和组合对象的使用具有一致性。
适用性
  • 你想表示对象的部分-整体层次结构。
  • 你希望用户忽略组合对象与单个对象的不同,用户将统一地使用组合结构中的所有对象。
Code Example
  1设计模式——复合模式// Composite
  2设计模式——复合模式
  3设计模式——复合模式// Intent: "Compose objects into tree structures to represent part-whole 
  4设计模式——复合模式// hierarchies. Composite lets clients treat individual objects and 
  5设计模式——复合模式// compositions of objects uniformly". 
  6设计模式——复合模式
  7设计模式——复合模式// For further information, read "Design Patterns", p163, Gamma et al.,
  8设计模式——复合模式// Addison-Wesley, ISBN:0-201-63361-2
  9设计模式——复合模式
 10

相关文章:

  • 2021-04-26
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-01-17
  • 2021-05-29
  • 2021-12-26
  • 2022-12-23
猜你喜欢
  • 2021-06-16
  • 2021-04-27
  • 2022-12-23
  • 2020-03-10
  • 2021-08-11
  • 2021-09-27
  • 2021-04-22
相关资源
相似解决方案