Пример #1
0
        static void Main(string[] args)
        {
            Chef chef = new Chef(); //super class

            chef.MakeChicken();
            chef.MakeSpecialDish();                      // makes the basic special dish defined in the Chef.cs super class

            ItalianChef italianchef = new ItalianChef(); // sub class inherits from super class

            italianchef.MakeChicken();
            italianchef.MakePasta();       //can only be run by the sub class with the extra method MakePasta
            italianchef.MakeSpecialDish(); //makes the sub class special dish by the override keyword
        }
Пример #2
0
        static void Main(string[] args)
        {
            Chef chef = new Chef();

            chef.MakeChicken();
            chef.MakeSpecialDish();

            ItalianChef italianChef = new ItalianChef();

            italianChef.MakeChicken();
            italianChef.MakePasta();
            italianChef.MakeSpecialDish();
        }