Wikipedia says:
individual objects
It seems to me that the example in the same Java wikipedia does not correspond to this statement. Print method:
public void print() { for (Graphic graphic : childGraphics) { graphic.print(); } } But in C # everything is in order:
public override void Display(int depth) { Console.WriteLine(new String('-', depth) + name); // Recursively display child nodes foreach (Component component in children) { component.Display(depth + 2); } } What I see? In Java, the composite works out all its children and forgets about itself!
In C #, the action itself is inherent in itself, and then the children are trained, which is correct in my understanding.
I did not understand something in the template or is it really a mistake?
Link to material: Linker (design pattern)