示例#1
0
        public static void Main(string[] args)
        {
            CalculateClient client = new CalculateClient();

            client.SetCalculate(new Minus());
            Console.WriteLine("Minus: " + client.Calculate(8, 2));

            client.SetCalculate(new Plus());
            Console.WriteLine("Plus: " + client.Calculate(7, 2));
        }
示例#2
0
        static void Main(string[] args)
        {
            var minusClient = new CalculateClient(new Minus());

            Console.WriteLine("10 - 3 = " + minusClient.Calculate(10, 3));

            var plusClient = new CalculateClient(new Plus());

            Console.WriteLine("10 + 3 = " + plusClient.Calculate(10, 3));
            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            var minusClient = new CalculateClient(new Minus());

            Console.WriteLine("10 - 3 = " + minusClient.Calculate(10, 3));

            var plusClient = new CalculateClient(new Plus());

            Console.WriteLine("10 + 3 = " + plusClient.Calculate(10, 3));
            Console.ReadKey();
        }