public static void Main(string[] args) { ConcreteVisitor visitor = new ConcreteVisitor(); ConcreteElement1 concreteElement1 = new ConcreteElement1(); concreteElement1.accept(visitor); ConcreteElement2 concreteElement2 = new ConcreteElement2(); concreteElement2.accept(visitor); }
static void Main(string[] args) { ConcreteVisitor vistor = new ConcreteVisitor(); ConcreteElementA elementA = new ConcreteElementA("Data in element A."); ConcreteElementB elementB = new ConcreteElementB("Data in element B."); Console.WriteLine(vistor.Vist(elementA)); Console.WriteLine(); Console.WriteLine(vistor.Vist(elementB)); }