Beispiel #1
0
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            CarSalesman steve = new CarSalesman("Steve", "Rogers");

            // Console.WriteLine(steve.FullName);
            steve.Sell();


            RetailSalesPerson jon = new RetailSalesPerson("jon", "bon");

            jon.Sell();

            //Dynamic polymorphism
            List <Salesman> salelist = new List <Salesman>()
            {
                new CarSalesman("bon", "Rogers"), new RetailSalesPerson("kon", "saa")
            };

            WebDeveloper Roan = new WebDeveloper("java");

            Roan.Code();
            Roan.Code("javascript", "thirsdal");
            Roan.Develop();
            foreach (var item in salelist)
            {
                ShowMeSell(item);
            }
Beispiel #2
0
        static void Main(string[] args)
        {
            CarSalesman carSalesman1 = new CarSalesman("James", "Maddison");

            carSalesman1.Sell();

            CarSalesman carSalesman2 = new CarSalesman("Thiery", "Henry");

            carSalesman2.Sell();

            RetailSalesPerson retailSalesPerson1 = new RetailSalesPerson("Luka", "Poldi");

            retailSalesPerson1.Sell();


            //Dynamic Polymorphism implements the above thing
            List <Salesman> salesmen = new List <Salesman>()
            {
                new CarSalesman("James", "Maddison"), new CarSalesman("Thiery", "Henry"), new RetailSalesPerson("Luka", "Poldi"), new InsuranceBroker("Luka", "jovic")
            };

            foreach (var item in salesmen)
            {
                showMeHowToSell(item);
            }
        }