Пример #1
0
        static void Main()
        {
            IAccount vGoldAccount  = new GoldAccount();
            IAccount vSaverAccount = new SaverAccount();

            ITransferAccount vCurAccount = new CurrentAccount();

            vGoldAccount.Credit(10000);
            vSaverAccount.Credit(100);

            Console.WriteLine($"Gold Account Balance {vGoldAccount.Balance,6:C}");
            Console.WriteLine(vSaverAccount.ToString());

            vSaverAccount.Debit(1000);


            IAccount[] allAccounts = new IAccount[2];
            allAccounts[0] = vGoldAccount;
            allAccounts[1] = vSaverAccount;

            //Dividend...
            foreach (IAccount Acc in allAccounts)
            {
                Acc.Credit(10);
            }


            vCurAccount.Transfer(vSaverAccount, vCurAccount);
        }