public virtual void HonkOn(IAutomotiveEntity other) { for (int i = 0; i < HonkCount; i++) { Console.Beep(); Console.WriteLine($"{Name} honks on the {other.Name}"); } }
public override void HonkOn(IAutomotiveEntity other) { base.HonkOn(other); Console.WriteLine(); var carInstances = GetInstances <Car>(); foreach (var car in carInstances) { Console.WriteLine(car.ToString()); } Console.WriteLine(); var truckInstances = GetInstances <Truck>(); foreach (var truck in truckInstances) { Console.WriteLine(truck.ToString()); } }