public T Accept <T>(Func <ICarVisitor <T> > visitorFactory)
        {
            ICarVisitor <T> visitor = visitorFactory();

            Accept(() => (ICarVisitor)visitor);
            return(visitor.ProduceResult());
        }
Example #2
0
 public void Accept(ICarVisitor v)
 {
     foreach (var e in _items)
     {
         e.Accept(v);
     }
     v.Visit(this);
 }
Example #3
0
 public static void Accept(this Car car, ICarVisitor visitor)
 {
     car.engine.Accept(visitor);
     foreach (Seat seat in car.seats)
     {
         seat.Accept(visitor);
     }
     // visitor.VisitCar(car.make, car.model);
     visitor.Visit(car);
 }
        public void Accept(Func <ICarVisitor> visitorFactory)
        {
            ICarVisitor visitor = visitorFactory();

            engine.Accept(() => visitor);
            foreach (Seat seat in seats)
            {
                seat.Accept(() => visitor);
            }
            visitor.VisitCar(make, model);
        }
Example #5
0
 public void PerformOperation(ICarVisitor visitor)
 {
     visitor.ChargeCreditCardEveryTimeCigaretteLighterIsUsed(this);
 }
Example #6
0
 public void PerformOperation(ICarVisitor visitor)
 {
     visitor.StickAccelerator(this);
 }
Example #7
0
 public void Accept(ICarVisitor v)
 {
     v.Visit(this);
 }