Mid GoF Patterns

Concrete Class (PastaRecipe):?

  • The PastaRecipe class is a concrete subclass that implements the specific details

of the steps defined in the abstract Recipe class. The steps like gathering

ingredients, preparing, and cooking are all tailored to pasta.

public class PastaRecipe : Recipe

protected override void GatherIngredients()

Console.WriteLine("Gathering pasta, sauce, and cheese.");

protected override void Prepare()

Console.WriteLine("Boiling pasta and preparing sauce.");

protected override void CookMethod()

Console.WriteLine("Cooking pasta with sauce.");

Follow:

More from Design Patterns in C#

All questions for this course