Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Chef chef = new Chef();

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

            ItalianChef italianChef = new ItalianChef();

            italianChef.MakeChicken();
            italianChef.MakePasta();
            italianChef.MakeSpecialDish();
        }
Exemplo n.º 2
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
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // Created a new chef object and told it to make chicken:
            Chef chef = new Chef();

            chef.MakeSpecialDish();

            ItalianChef italianChef = new ItalianChef();

            italianChef.MakeSpecialDish();

            Console.ReadLine();
        }