"Design Model Design Pattern" reading notes
Composite mode
purpose
In a Part-Whole inheritance structure, the overall (Object, Component) is treated uniformly. In this way, the same operation can be performed without the use of the CLIENT.
structure
discuss
1. A disadvantage is that it is difficult to restrict Component in CompositeTe.
2, sometimes adding a Parent Reference will be more useful; however, if Component is able to share, it will bring multiple Parent issues, and the Flyweight mode provides a solution that does not need to save the Parent Reference.
Reference
"Design Pattern" Gang-Of-4 1997