CARP(Composition/Aggregation Reuse Principle)合成/聚合复用原则

 Favor Composition over Inheritance,优先使用对象合成/聚合关系,而不是使用类继承,这样能降低对象间的耦合关系,从而减少对象间的依赖关系。

实现:

对象适配器模式,桥接模式。

你可能感兴趣的:(inheritance)