Decorator

xiaoxiao2021-03-06  65

Benefits: • It provides greater flexibility than static inheritance • It avoids the need to place feature-laden classes higher up the hierarchy • It simplifies coding by allowing you to develop a series of functionalitytargeted classes, instead of coding all of the behavior into.. The object.

Applicable Scenarios: • You want to transparently and dynamically add responsibilities to objects without affecting other objects • You want to add responsibilities to an object that you may want to change in the future • Extending functionality by subclassing is no longer practical...

转载请注明原文地址:https://www.9cbs.com/read-120215.html

New Post(0)