public void Transfer(AAccount receiver, double amount) { if (amount < limit) { account.Transfer(receiver, amount); } else { throw new AccountException("Suspicious Client"); } }
public void Transfer(AAccount receiver, double amount) { if (CheckForTransfer(receiver, amount)) { ExtraForTransfer(receiver, amount); this.balance -= amount; receiver.balance += amount; } else { throw new AccountException("Cannot make a transfer"); } }
protected override void ExtraForTransfer(AAccount receiver, double amount) { balance -= comission * amount; }
protected override bool CheckForTransfer(AAccount receiver, double amount) { double after_transfer = balance - amount; return(after_transfer > 0 || after_transfer - comission * amount > -limit); }
protected override void ExtraForTransfer(AAccount receiver, double amount) { }
protected override bool CheckForTransfer(AAccount receiver, double amount) { double after_transfer = balance - amount; return(after_transfer > 0); }
protected abstract void ExtraForTransfer(AAccount receiver, double amount);
protected abstract bool CheckForTransfer(AAccount receiver, double amount);