Forums Register Login
Composite design pattern
i created this program from my understanding, do you think this is correct example of composite design pattern ?

(1 like)
No, because all that allows you to go is have a Composite containing a single Leaf. The idea behind the composite pattern is to allow you to build a hierarchy of grouped objects. So what you need is to implement it so that each Composite object can contain multiple Component objects (not just Leafs). That way you can put Composites inside Composites.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 710 times.

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2018 12:06:48.