コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: 04_Developer.cs プロジェクト: cessor/empathiccode
 public decimal PayAmount(IGetPaid employee, decimal salary)
 {
     return employee.PayAmount(salary);
 }