コード例 #1
0
ファイル: BankAccount.cs プロジェクト: d4nc3r/BankingSolution
 public void Withdraw(decimal amountToWithdraw)
 {
     if (amountToWithdraw > _balance)
     {
         throw new OverdraftException();
     }
     _balance -= amountToWithdraw;
     _feds.Notify(this, amountToWithdraw);
 }
コード例 #2
0
 public void Withdraw(decimal amountToWithdraw)
 {
     if (amountToWithdraw > balance)
     {
         throw new OverdraftException();
     }
     else
     {
         balance -= amountToWithdraw;
         Feds.Notify(this, amountToWithdraw); // Command "Tell Don't Ask"
     }
 }