private static void Main(string[] args)
        {
            SavingAccount         account1        = new RegularSavingAccount();
            SavingAccount         accountReadOnly = new SalarySavingAccount();
            SavingAccountReadOnly account3        = new FixDepositSavingAccount();

            AccountManager.WithdrawFrom(account1, 100);
            AccountManager.WithdrawFrom(accountReadOnly, 200);
            AccountManager.WithdrawFrom(account3, 300);
        }
Example #2
0
        public void Main()
        {
            IAccount account = new RegularSavingAccount();

            account.Balance = 500;
            Console.WriteLine(account.CalcInterest());

            account         = new SalarySavingAccount();
            account.Balance = 5000;
            Console.WriteLine(account.CalcInterest());

            account         = new CorporateAccount();
            account.Balance = 5000;
            Console.WriteLine(account.CalcInterest());
        }