i created this program from my understanding, do you think this is correct example of composite design pattern ?
My one regret in life is that I am not someone else.
- Woody Allen
posted 3 years ago
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 multipleComponent objects (not just Leafs). That way you can put Composites inside Composites.