mercredi 22 septembre 2021

Decorator design pattern with Composite Design pattern

I understand the composite design pattern and the decorator design pattern and their uses. Can we have a case where we have to use them together? How would the class diagram for such a scenario look like?

Will we have the decorator(from Decorator design pattern), leaf nodes, and composite(from Composite design pattern) inherited from the Component? Here is what I am referring to for the decorator pattern:wiki link for decorator pattern and for composite pattern: composite wiki link

Aucun commentaire:

Enregistrer un commentaire