学习笔记,原文链接 https://refactoringguru.cn/design-patterns/composite
将对象组合成树状结构, 并且能像使用独立对象一样使用它们。组合最主要的功能是在整个树状结构上递归调用方法并对结果进行汇总。


可以把各种形状组合到一个CompoundShape类中,统一处理。多个shape全加进来一起paint的

学习笔记,原文链接 https://refactoringguru.cn/design-patterns/composite
将对象组合成树状结构, 并且能像使用独立对象一样使用它们。组合最主要的功能是在整个树状结构上递归调用方法并对结果进行汇总。
可以把各种形状组合到一个CompoundShape类中,统一处理。多个shape全加进来一起paint的