设计模式纵横谈

组合模式(Composite)

Composite objects into a tree structure so that individual objects and compositions of objects can be treated uniformly.

组合模式组合出了一个树形结构(tree structure),而树形结构是一种特殊的层次结构(Hierarchical structure)。

模板方法(Template Method)

模板方法提供的流程是骨架,子类无须覆盖模板方法本身,只需继承即可,即模板方法无须是 virtual 的,算法的流程、骨架自然无需重写。

  • (1)面向对象编程思想(OOP)是设计模式的基石,设计模式是面向对象的进阶和完美诠释;

  • (2)设计模式设计的是类间的关系

你可能感兴趣的:(设计模式纵横谈)