Example #1
0
        static void Main(string[] args)
        {
            Car theCar = new CompactCar();

            theCar = new Sunroof(theCar);

            Console.WriteLine(theCar.GetDescription());
            Console.WriteLine(theCar.GetPrice());
        }
Example #2
0
        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();
        }
Example #3
0
        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();
        }