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

            theCar = new Sunroof(theCar);

            Console.WriteLine(theCar.GetDescription());
            Console.WriteLine(theCar.GetPrice());
        }
예제 #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();
        }
예제 #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();
        }