コード例 #1
0
        public int AddAccount(AccountType type, decimal bal, string owner)
        {
            Account acc;
            int     id = nextid++;

            switch (type)
            {
            case AccountType.Checking:
                acc = new CheckingAccount(bal, owner, id);
                break;

            case AccountType.Savings:
                acc = new SavingsAccount(bal, owner, id);
                break;

            default:
                Console.WriteLine("Unexpected AccountType");
                return(-1);
            }
            accounts.Add(acc);
            return(id);
        }
コード例 #2
0
        public void DeleteAccount(int id)
        {
            CheckingAccount acc = new CheckingAccount(0m, "", id);

            accounts.Remove(acc);
        }