Пример #1
0
        static void Main()
        {
            // Basic vehicle
            IVehicle hondaCar = new HondaCity();

            Console.WriteLine("Honda City base price is : {0} $", hondaCar.Price);

            // Special offer
            VehicleSpecialOffer hondaCarSpecialOffer = new VehicleSpecialOffer(hondaCar);

            hondaCarSpecialOffer.DiscountPercentage = 50;
            hondaCarSpecialOffer.Offer = $"{hondaCarSpecialOffer.DiscountPercentage} % discount";

            Console.WriteLine($"{hondaCarSpecialOffer.Offer} @ ShopoffAuto Special Offer and price is : {hondaCarSpecialOffer.Price} $");
        }
Пример #2
0
        static void Main(string[] args)
        {
            // Basic vehicle
            HondaCity car = new HondaCity();

            Console.WriteLine("Honda City base price are : {0}", car.Price);

            // Special offer
            SpecialOffer offer = new SpecialOffer(car);

            offer.DiscountPercentage = 25;
            offer.Offer = "25 % discount";

            Console.WriteLine("{1} @ Christmas Special Offer and price are : {0} ", offer.Price, offer.Offer);

            Console.ReadKey();
        }