Sunday, June 15, 2014

Composite Pattern in Java

Simple Note

From reference:
the composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.


Run to test.

A Calculator probably consists of several child Calculators, you can change mode from parent Calculator then get result as needed.


Composite pattern

No comments:

Post a Comment