static void Main2301() { Console.WriteLine("Hello Visitor Pattern!"); var objectStructure = new ObjectStructure(); var concreteNodeA = new ConcreteNodeA(); var concreteNodeB = new ConcreteNodeB(); objectStructure.Add(concreteNodeA); objectStructure.Add(concreteNodeB); Console.WriteLine("------------------访问者A访问元素------------------"); objectStructure.Action(new ConcreteVisitorA()); Console.WriteLine("------------------访问者B访问元素------------------"); objectStructure.Action(new ConcreteVisitorB()); Console.ReadLine(); }