示例#1
0
        static void Main(string[] args)
        {
            FullTimeEmployee fte = new FullTimeEmployee();

            fte.Id        = 100;
            fte.FirstName = "Magesh";
            fte.LastName  = "K";
            fte.Bonus     = 10000m;
            fte.Print();

            fte.Play();

            ContractEmployee cte = new ContractEmployee();

            cte.Id             = 200;
            cte.FirstName      = "Suresh";
            cte.LastName       = "K";
            cte.ContractorName = "Some Body Shopper";
            cte.Print();

            Console.ReadLine();
            Console.WriteLine();
            Console.WriteLine("From employees array");
            Console.WriteLine();
            Employee[] employees = new Employee[] { fte, cte };
            for (var i = 0; i < employees.Length; i++)
            {
                employees[i].Print();
                Console.WriteLine();
            }
            Console.WriteLine();

            IPlayCricket[] cricketeres = new IPlayCricket[]
            {
                new FullTimeEmployee(), new ContractEmployee()
            };
            for (var i = 0; i < cricketeres.Length; i++)
            {
                //cricketeres[i].
            }
            Console.WriteLine("Done");
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            IPlayCricket[] team = new IPlayCricket[3];
            team[0] = new SoftwareDeveloper()
            {
                Name = "Magesh"
            };
            team[1] = new Manager()
            {
                Name = "Suresh"
            };
            team[2] = new SoftwareDeveloper()
            {
                Name = "Ganesh"
            };

            for (var i = 0; i < team.Length; i++)
            {
                team[i].Play();
            }

            Console.ReadLine();
        }