static void Main(string[] args) { IWorker[] workers = new IWorker[] { new Manager(), new Worker(), new Robot(), }; foreach (var worker in workers) { worker.Work(); } IEat[] eats = new IEat[] { new Manager(), new Worker(), }; foreach (var eat in eats) { eat.Eat(); } IGetPaid[] getPaids = new IGetPaid[] { new Manager(), new Worker(), }; foreach (var getPaid in getPaids) { getPaid.GetPaid(); } }
public decimal PayAmount(IGetPaid employee, decimal salary) { return employee.PayAmount(salary); }