コード例 #1
0
        public void Open(Bank bank, AccountType accountType, decimal sum)
        {
            Account newAccount = accountType switch
            {
                AccountType.Ordinary => new DemandAccount(sum, 1),
                AccountType.Deposit => new DepositAccount(sum, 40),
                _ => throw new ArgumentOutOfRangeException(nameof(accountType))
            };

            _accountStorage.Add(bank, newAccount);

            _output.OutputMessage(newAccount.OpenText);
        }
    }