There are three base implementations provided for sub-classing.
所提供的用于生成子类的基本实现有三种。
After 24 pages we reach a much better design, which mainly USES a map to store properties rather than sub-classing for each type of instrument.
在24页之后,我们看到了更好的设计,主要用map来存储属性,而不是为每种乐器类型建立子类。
Attach additional responsibilities to an object dynamically keeping the same interface. Decorators provider a flexible alternative to sub-classing for extending functionality.
动态的给一个对象添加一些额外的职责,就增加功能而言,装饰模式能相比生成子类更为灵活。
应用推荐