示例#1
0
        private static void Main()
        {
            IBankAccount venusAccount = new SaverAccount();
            ITransferBankAccount jupiterAccount=new CurrentAccount();

            venusAccount.PayIn(300);
            jupiterAccount.PayIn(400);

            jupiterAccount.TransferTo(venusAccount,200);

            Console.WriteLine(venusAccount.ToString());
            Console.WriteLine(jupiterAccount.ToString());
        }
示例#2
0
        private static void Main()
        {
            // without double inheritence.
            var venusAccount = new SaverAccount();
            var jupiterAccount=new GoldAccount();

            venusAccount.PayIn(200);
            jupiterAccount.PayIn(300);

            Console.WriteLine(venusAccount.ToString());

            jupiterAccount.PayIn(400);
            jupiterAccount.Withdraw(600);
            jupiterAccount.Withdraw(200);

            Console.WriteLine(jupiterAccount.ToString());
        }