public void AddComponent(Component originalComponent, Component addedComponent) { if (originalComponent.IsComposite()) { originalComponent.Add(addedComponent); } Console.WriteLine($"RESULT:{originalComponent.Display()}"); }
public void ClientCode2(Component component1, Component component2) { if (component1.IsComposite()) { component1.Add(component2); } Console.WriteLine($"RESULT: {component1.Operation()}"); }
public void GetElementofComponent(Component component1, int index) { if (component1.IsComposite()) { component1.GetChild(index); } Console.WriteLine($"Result: {component1.Operation()}"); }
public void RemoveComponentofComponent(Component component1, Component component2) { if (component1.IsComposite()) { component1.Remove(component2); } Console.WriteLine($"Result: {component1.Operation()}"); }
//ADICIONA UM COMPONENTE A OUTRO COMPONENTE public void AddComponentToComponent(Component component1, Component component2) { if (component1.IsComposite()) { component1.Add(component2); } Console.WriteLine($"Result: {component1.Operation()}"); }
public void ClientCode2(Component component, Component component2) { if (component.IsComposite()) { component.Add(component2); } Console.WriteLine($"Result: {component.Operation()}\r\n"); }