Thursday, November 26, 2015


Composite defines an abstract base class (Component) that specifies the behavior that needs to be exercised uniformly across all primitive and composite objects

The model shall consist of a generic entry point (the Component), of retail elements (Leaf) and of composite objects. A very simple example would be a salad :

* The Component would be the Ingredient with a generic method addTaste()
* The Leafs would be Salad, Tomatoes, Onions, Cheese
* The Composite element would be the Salad (it shall call addTaste for each ingredient)


Post a Comment

Note: Only a member of this blog may post a comment.