示例#1
0
        static void Main()
        {
            //Console.WriteLine("Hello World!");

            //Console.WriteLine(SimpleMath.Add(34,23.5));

            //using overload
            double[] numbers = new double[] { 1, 2, 3, 43, 34553 };
            var      result  = SimpleMath.Add(numbers);

            Console.WriteLine(result);


            BankAccount bankAccount = new BankAccount();

            bankAccount.AddToBalance(100);
            Console.WriteLine(bankAccount.Balance);

            ChildBankAccount childBankAccount = new ChildBankAccount();

            childBankAccount.AddToBalance(30);
            Console.WriteLine(childBankAccount.Balance);

            //Using the interfaces
            SimpleMath simpleMath = new SimpleMath();

            Console.WriteLine(Information(bankAccount));
            Console.WriteLine(Information(simpleMath));
        }
示例#2
0
        static void Main(string[] args)
        {
            double[] numbers = new double[] { 1, 2, 3, 42, 42154 };
            SimpleMath.Add(numbers);

            BankAccount bankAccount = new BankAccount(1000);

            Console.WriteLine("Original balance: {0}", bankAccount.Balance);
            bankAccount.AddToBalance(100);
            Console.WriteLine("Increased balance: {0}", bankAccount.Balance);

            ChildBackAccount childBackAccount = new ChildBackAccount();

            Console.WriteLine("\tOriginal child balance: {0}", childBackAccount.Balance);
            childBackAccount.AddToBalance(10);
            Console.WriteLine("\tIncreased child balance: {0}", childBackAccount.Balance);

            Console.ReadLine();
        }