public bool TransferMoney(IBankAccount otherAccount, decimal amount) { var fee = CalculateFee(amount, WithDrawType.Transfer); if (UpdateBalance(amount + fee)) { otherAccount.DepositMoney(amount); } return(true); }
static void Main(string[] args) { BankAccountFactory localBankAccFact = new LocalBankAccountFactory(); BankAccountFactory foreignBankAccFact = new ForeignBankAccountFactory(); IBankAccount localBankAcc = localBankAccFact.CreateBankAccount(); localBankAcc.DepositMoney(40); IBankAccount foreignBankAcc = foreignBankAccFact.CreateBankAccount(); foreignBankAcc.DepositMoney(40); Console.ReadKey(); }
public bool TransferMoney(IBankAccount otherAccount, decimal amount) { this.WithDrawMoney(amount); otherAccount.DepositMoney(amount); return true; }
public bool TransferMoney(IBankAccount otherAccount, decimal amount) { var fee = CalculateFee(amount, WithDrawType.Transfer); if (UpdateBalance(amount + fee)) { otherAccount.DepositMoney(amount); } return true; }
public bool TransferMoney(IBankAccount otherAccount, decimal amount) { this.WithDrawMoney(amount); otherAccount.DepositMoney(amount); return(true); }