Composite: Implementation
If objects in a composite delegate to their parent, you can keep them fast and simple if they contain a parent reference.
You must implement the parent pointer in a way that ensures consistency between parent and child. Having the method that add a child to a parent also set the child’s parent is a good way to do that.