static void Main(string[] args) { Car theCar = new CompactCar(); theCar = new Sunroof(theCar); Console.WriteLine(theCar.GetDescription()); Console.WriteLine(theCar.GetPrice()); }
static void Main(string[] args) { Car theCar = new CompactCar(); theCar = new Navigation(theCar); theCar = new LeatherSeats(theCar); theCar = new Sunroof(theCar); Console.WriteLine(theCar.GetDescription()); Console.WriteLine($"{theCar.GetCarPrice():C2}"); Console.ReadKey(); }
static void Main(string[] args) { Car compactCar = new CompactCar(); compactCar = new Navigation(compactCar); compactCar = new Sunroof(compactCar); Console.WriteLine(compactCar.GetDescription()); Console.WriteLine(compactCar.GetPrice()); Console.ReadLine(); }