- Make FoodItem abstract.
- Set the Prepare method to abstract.
- Check your work: Build the solution.
Note: The Meal and Drink method can no longer call the abstract FoodItem's Prepare method.
- Remove the call to base in the Meal class Drink class prepare methods.
- Check your work: Build the solution.
Note: The FoodItem class needs to be abstract in order to contain the abstract Prepare method.
- Set the FoodItem class to abstract.
- Check your work: Build the solution.
Note: The Drink class does not have a Prepare method.
- Define a Prepare method in the Drink class. Set it to override FoodItem's Prepare method.
- Check your work: Build the solution and ensure that the code compiles without errors or warnings.
- Set Drink class to abstract.
- Set ColdDrink class to abstract.
- Check your work: Build the solution and ensure that the code compiles without errors or warnings.
- Pour the Drink.
- Define a Pour method in the Drink class.
- Have the overriding Prepare method call Pour.
- Check your work: Build the solution and ensure that the code compiles without errors or warnings.
- Set Remaining Abstract Methods.
- Set the Meal, CookedMeal, UncookedMeal, and HotDrink methods abstract.
- Check your work: Build the solution and ensure that the code compiles without errors or warnings.
- Protect the Cook method.
- Within the Cook's MakeMeal method, instantiate a new Meatloaf.
- Place a call to the Meatloaf's Cook method.
- Check your work: Build the solution.
Note: The cook is currently able to call the meatloaf's Cook method. He should not be able to call the method directly. He only needs to call the Prepare method.
- Define the Cook method as protected within CookedMeal class.
- Check your work: Build the solution.
Note: If the virtual Cook method in CookedMeal is protected, then all descendents which override it must also be protected.
- Define the Cook method as protected within the Meatloaf and PotRoast classes.
- Check your work: Build the solution.
Note: The cook cannot call the meatloaf's Cook method directly because it is no longer public.
- Remove the test code from the Cook class.
- Check your work:
- Customize the Cook method in descendents of the CookedMeal class.
- Set the CookedMeal.Cook method to abstract.
- Check your work: Build the solution.
Note: The Meatloaf and PotRoast class can no longer call to base in their cook methods, due to Cook class being abstract.
- Remove the call to base.Cook within the Meatloaf and PotRoast Cook methods.
- Check your work:
- Custom ToString method for FoodItems.
- Have ToString display the result of FoodItem.Type
- Check your work:
- Run the application
- Refactor FoodItem.Type to include spaces
- Set the Type property to virtual.
- Define a Type property in TurkeyClub and PotRoast. Set it to override.
- Have the Type property return an string rather than the result of this.GetType().Name
- Check your work:
- Run the application
- Give Food Calories
- Define an abstract Calories property in the FoodItem class.
- Check your work: Build the solution and ensure that the code compiles without errors or warnings.
- Define overriding Calories properties in all instantiated food classes.
- Check your work:
- Run the application
- Display FoodItem Calories
- Update FoodItem's ToString to include calories in this format: FoodItemName (Calories).
- Check your work:
- Run the application
- Submit