Пример #1
0
        private static void Main(string[] args)
        {
            PaymentStrategy paymentStrategy1 = new CashStrategy();
            PaymentStrategy paymentStrategy2 = new CheckStrategy();
            PaymentStrategy paymentStrategy3 = new DebitCardStrategy();

            paymentStrategy1.Pay(100);
            paymentStrategy2.Pay(150);
            paymentStrategy3.Pay(300);

            Console.ReadKey();
        }
        private static void Main(string[] args)
        {
            var customer = new Customer("Cristian", 123456, new DebitCardStrategy());

            customer.Pay(100);

            customer.PaymentStrategy = new CashStrategy();
            customer.Pay(300);

            IPaymentStrategy paymentStrategy = new CashStrategy();

            paymentStrategy.Pay(20);

            Console.ReadKey();
        }