Esempio n. 1
0
        public Driver(CarFactory carFactory)
        {
            if (carFactory == null)
            {
                throw new ArgumentNullException(nameof(carFactory));
            }

            _sportsCar = carFactory.CreateSportsCar();
            _familyCar = carFactory.CreateFamilyCar();
        }
 public override void Speed(SportsCar abstractSportsCar)
 {
     Console.WriteLine(GetType().Name + " is slower than "
                       + abstractSportsCar.GetType().Name);
 }
Esempio n. 3
0
 public override void CompareToSport(SportsCar sportsCar)
 {
     Console.WriteLine($"{this} is slower than {sportsCar}, but it is more practical and classy.");
 }
 public Driver(CarFactory carFactory)
 {
     _sportsCar = carFactory.CreateSportsCar();
     _familyCar = carFactory.CreateFamilyCar();
 }