Implemented a basic example of the composite pattern