Thursday, November 26, 2015

Composite

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)

0 comments:

Post a Comment