skip to Main Content


Say hello to the toggle bar. This is an optional section you can use to display any content you'd like. Simply select a page from the theme panel and the content of the page will display here. You can even use the drag and drop builder to create this! This is a perfect place for your company mission statement, alerts, notices or anything else.

Get In Touch

Phone: 1-800-Total-Theme
Address: Las Vegas, Nevada

Our Location


Composite Pattern

Post Series: Structual Design Pattern

Composite pattern is used to separate an abstraction from its implementation (a group of objects and a single object) so that both can be modified independently.

Component: This is an abstract class containing members that will be implemented by all object in the hierarchy. It acts as the base class for all the objects within the hierarchy
Composite: This is a class which includes Add,Remove,Find and Get methods to do operations on child components.
Leaf: This is a class which is used to define leaf components within the tree structure means these cannot have children.



  1. Hierarchical representations of objects are required.
  2. A single object and a group of objects should be treated in the same way.
  3. The Composite pattern is used when data is organized in a tree structure (for example directories in a computer).


Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top