예제 #1
0
        static void Main()
        {
            var visitor = new CarElementPrintVisitor();

            var car = new Car();

            car.Accept(visitor);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Wheel  wheel  = new Wheel();
            Body   body   = new Body();
            Engine engine = new Engine();

            CarElement[] elements = new CarElement[3] {
                wheel, body, engine
            };
            Car car = new Car(elements);
            CarElementPrintVisitor visitor = new CarElementPrintVisitor();

            car.accept(visitor);
        }