private Element BuildComposition() { ConcreteElementA a1 = new ConcreteElementA(); ConcreteElementA a2 = new ConcreteElementA(); ConcreteElementB b1 = new ConcreteElementB(); ConcreteElementC c1 = new ConcreteElementC(); ConcreteElementC c2 = new ConcreteElementC(); c1.AddElement(a1).AddElement(c2); c2.AddElement(a2).AddElement(b1); return(c1); }
public void Visit(ConcreteElementC element) { Console.WriteLine("Visiting " + element.Name + " ..."); }