Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Composite design pattern

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i created this program from my understanding, do you think this is correct example of composite design pattern ?



 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic