コード例 #1
0
        //访问者
        public static void testVisitor()
        {
            ObjectStructure o = new ObjectStructure();

            o.Attach(new Man());
            o.Attach(new Woman());

            Success v1 = new Success();

            o.Display(v1);

            Failing v2 = new Failing();

            o.Display(v2);

            Amativeness v3 = new Amativeness();

            o.Display(v3);

            Marriage v4 = new Marriage();

            o.Display(v4);

            Console.Read();
        }
コード例 #2
0
    void TestVisitor()
    {
        ObjectStructure structure = new ObjectStructure();

        structure.Attach(new Man());
        structure.Attach(new Woman());

        Success success = new Success();

        structure.Display(success);

        Failing failing = new Failing();

        structure.Display(failing);

        Amativeness amativeness = new Amativeness();

        structure.Display(amativeness);
    }
コード例 #3
0
        public void VistorTest()
        {
            ObjectStructure o = new ObjectStructure();

            o.Attach(new Man());
            o.Attach(new Woman());

            Success v1 = new Success();

            o.Display(v1);

            Failing v2 = new Failing();

            o.Display(v2);

            Amativeness v3 = new Amativeness();

            o.Display(v3);

            Marriage v4 = new Marriage();

            o.Display(v4);
        }