Mid GoF Patterns

Concrete Factories (Windows & Mac):?

  • The WindowsUIFactory and MacUIFactory are concrete implementations

of the IUIFactory interface. Each factory creates platform-specific objects

like buttons and checkboxes.

public class WindowsUIFactory : IUIFactory

public IButton CreateButton() => new WindowsButton();

public ICheckbox CreateCheckbox() => new WindowsCheckbox();

public class MacUIFactory : IUIFactory

public IButton CreateButton() => new MacButton();

public ICheckbox CreateCheckbox() => new MacCheckbox();

More from Design Patterns in C#

All questions for this course