Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // Create math proxy
            CalculateProxy proxy = new CalculateProxy();

            // Do some math
            Console.WriteLine("Calculations");
            Console.WriteLine("-------------");
            Console.WriteLine("\n10 + 5 = " + proxy.Add(10, 5));
            Console.WriteLine("\n10 - 5 = " + proxy.Subtract(10, 5));
            Console.WriteLine("\n10 * 5 = " + proxy.Multiply(10, 5));
            Console.WriteLine("\n10 / 5 = " + proxy.Divide(10, 5));

            // Wait for user
            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main()
        {
            // Create math proxy
            //IE, create a calculator instead of some platonic "math"
            //note we call the proxy/calculator's methods, not the methods from Math.
            //but THOSE methods call Math's methods.
            CalculateProxy proxy = new CalculateProxy();

            // Do some math
            //We do the math, but only via the help of the proxy.
            Console.WriteLine("Calculations");
            Console.WriteLine("-------------");
            Console.WriteLine("\n10 + 5 = " + proxy.Add(10, 5));
            Console.WriteLine("\n10 - 5 = " + proxy.Subtract(10, 5));
            Console.WriteLine("\n10 * 5 = " + proxy.Multiply(10, 5));
            Console.WriteLine("\n10 / 5 = " + proxy.Divide(10, 5));

            // Wait for user
            Console.ReadKey();
        }