CPP applying Composite pattern