Mid GoF Patterns

Product (Pizza):?

  • The Pizza class is the Product that we are constructing. It has properties for

Dough, Sauce, and a list of Toppings. The ToString() method is

overridden to provide a string representation of the pizza.

public class Pizza

public string Dough { get; set; }

public string Sauce { get; set; }

public List<string> Toppings { get; } = new List<string>();

public override string ToString() =>

$"Pizza with {Dough} dough, {Sauce} sauce and toppings:

{string.Join(", ", Toppings)}";

More from Design Patterns in C#

All questions for this course