コード例 #1
0
ファイル: Visitor.cs プロジェクト: xs2ranjeet/13ns9-1spr
    static void Main()
    {
      // Setup structure
      ObjectStructure o = new ObjectStructure();
      o.Attach(new ConcreteElementA());
      o.Attach(new ConcreteElementB());
 
      // Create visitor objects
      ConcreteVisitor1 v1 = new ConcreteVisitor1();
      ConcreteVisitor2 v2 = new ConcreteVisitor2();
 
      // Structure accepting visitors
      o.Accept(v1);
      o.Accept(v2);
 
      // Wait for user
      Console.ReadKey();
    }
コード例 #2
0
ファイル: MainApp.cs プロジェクト: sidiqahmed/GoF
        static void Main()
        {
            // Setup structure
            ObjectStructure o = new ObjectStructure();

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

            // Create visitor objects
            ConcreteVisitor1 v1 = new ConcreteVisitor1();
            ConcreteVisitor2 v2 = new ConcreteVisitor2();

            // Structure accepting visitors
            o.Accept(v1);
            o.Accept(v2);

            // Wait for user
            Console.ReadKey();
        }
コード例 #3
0
        public static void Run()
        {
            // Setup structure
            ObjectStructure o = new ObjectStructure();

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

            // Create visitor objects
            ConcreteVisitor1 v1 = new ConcreteVisitor1();
            ConcreteVisitor2 v2 = new ConcreteVisitor2();

            // Structure accepting visitors
            o.Accept(v1);
            o.Accept(v2);

            Console.WriteLine();
            Console.WriteLine("******************************************");
            Console.WriteLine();
        }