Ejemplo n.º 1
0
        static void Main()
        {
            var objectStructure = new ObjectStructure();
            var first           = new ElementA("Adam, Element A");
            var second          = new ElementB("Benny, Element B");

            objectStructure.Add(first);
            objectStructure.Add(second);

            var firstVisitor  = new ConcreteVisitorA();
            var secondVisitor = new ConcreteVisitorB();

            objectStructure.Accept(firstVisitor);
            Console.WriteLine();
            objectStructure.Accept(secondVisitor);
        }
Ejemplo n.º 2
0
 public void VisitElementA(ElementA elementA)
 {
     Console.WriteLine($"ConcreteVisitorB visited {elementA.Name}");
 }