static void Main(string[] args) { var car = new Car(); car.Accept(new CarElementPrintVisitor()); car.Accept(new CarElementDoVisitor()); Console.ReadKey(); }
private static void Main(string[] args) { var car = new Car(); car.Accept(new CarElementPrintVisitor()); car.Accept(new CarElementDoVisitor()); Console.ReadKey(); }
static void Main(string[] args) { var car = new Car(); var v1 = new TestCarVisitor(); var v2 = new RepairCarVisitor(); car.Accept(v1); car.Accept(v2); Console.ReadLine(); }
static void Main(string[] args) { var car = new Car(new List <ICarElement> { new Body("Body"), new Engine("Engine"), new Wheel("Wheel") }); car.Accept(new CarElementRepairVisitor()); car.Accept(new CarElementPrintVisitor()); Console.ReadKey(); }