static void Main(string[] args) { Chef chef = new Chef(); chef.MakeChicken(); chef.MakeSpecialDish(); ItalianChef italianChef = new ItalianChef(); italianChef.MakeChicken(); italianChef.MakePasta(); italianChef.MakeSpecialDish(); }
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 }
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(); }