Example #1
0
        static public void Main()
        {
            ObjectStructure  objectStructur   = new ObjectStructure();
            ConcreteVisitorA concreteVisitorA = new ConcreteVisitorA();
            ConcreteVisitorB concreteVisitorB = new ConcreteVisitorB();

            objectStructur.VisitElementX(concreteVisitorA);
            objectStructur.VisitElementX(concreteVisitorB);

            objectStructur.VisitElementY(concreteVisitorA);
            objectStructur.VisitElementY(concreteVisitorB);
        }
Example #2
0
        private static void Main()
        {
            var objectStructure = new ObjectStructure();

            objectStructure.Attach(new ConcreteElementA());
            objectStructure.Attach(new ConcreteElementB());

            var concreteVisitorA = new ConcreteVisitorA();
            var concreteVisitorB = new ConcreteVisitorB();

            objectStructure.Accept(concreteVisitorA);
            objectStructure.Accept(concreteVisitorB);

            Console.ReadKey();
        }