Exemple #1
0
        static void Main(string[] args)
        {
            int x = 10;

            switch (x)
            {
            case 1:
                Console.WriteLine("Item is 1");
                break;

            case 10:
                Console.WriteLine("Item is 10");
                break;

            default:
                Console.WriteLine("Item is not allowed");
                break;
            }

            //SWITCH - ALLOWS US TO
            // DoThis();
            ///DoThis(10);

            //static void DoThis()
            //{
            // Console.WriteLine("Doing something");
            //}

            //static void DoThis(int x) { Console.WriteLine("I am doing something"); }


            //POLYMORPHISM
            var p = new Parent();

            p.HaveAParty();

            var c1 = new Child1();

            c1.HaveAParty();

            var c2 = new Child2();

            c2.HaveAParty();

            var c3 = new Child3();

            c3.HaveAParty();
        }
        static void Main(string[] args)
        {
            var p = new Parent();

            p.HaveAParty();

            var c1 = new Child1();

            c1.HaveAParty();
            var c2 = new Child2();

            c2.HaveAParty();
            var c3 = new Child3();

            c3.HaveAParty();
            var c4 = new Child4();

            c4.HaveAParty();
        }