static void Main(string[] args) { Car theCar = new CompactCar(); theCar = new LeatherSeats(theCar); theCar = new Navigation(theCar); theCar = new SunRoof(theCar); Console.WriteLine(theCar.GetCarDescription()); Console.WriteLine($"{theCar.GetCarPrice():C2}"); Console.ReadKey(); }
static void Main(string[] args) { Car myCar = new CompactCar(); myCar = new LeatherSeats(myCar); myCar = new Navigation(myCar); myCar = new Sunroof(myCar); Console.WriteLine("Description of the car is {0}", myCar.GetDescription()); Console.WriteLine("The price of the car is {0}", myCar.GetCarPrice()); }