private static void PayAnnualInterest(Account[] accounts) { foreach (Account acc in accounts) { IProfitable p = acc as IProfitable; if (p != null) { double interest = p.GetInterest(12); acc.Deposit(interest); } } }
private static void PayAnnualInterest(Account[] group) { foreach (var acc in group) { IProfitable p = acc as IProfitable; if (p != null) { double i = p.GetInterest(1); acc.Deposit(i); } } }