Mid From PDF GoF Patterns Gang of Four 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.");

}
}

More from Design Patterns in C#

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details