Пример #1
0
        public Driver(CarFactory carFactory)
        {
            if (carFactory == null)
            {
                throw new ArgumentNullException(nameof(carFactory));
            }

            _sportsCar = carFactory.CreateSportsCar();
            _familyCar = carFactory.CreateFamilyCar();
        }
Пример #2
0
 public Factory(FamilyCar familyCar, SportCar sportCar)
 {
     _familyCar = familyCar;
     _sportCar  = sportCar;
 }
Пример #3
0
 public abstract void Speed(FamilyCar famCar);
Пример #4
0
 public override void Speed(FamilyCar famCar)
 {
     WriteLine(GetType().Name + " is faster than " + famCar.GetType().Name);
 }
Пример #5
0
 public Driver(CarFactory carFactory)
 {
     _sportsCar = carFactory.CreateSportsCar();
     _familyCar = carFactory.CreateFamilyCar();
 }