Factory Method Pattern

Factory Method Pattern

The factory method pattern provides an abstract virtual object constructor that you can override in subclasses. This gives you full control over the object creation process, in contrast to the 'new' operator which always creates a new instance of the given type. 

In this lecture, I will demonstrate the pattern and show you how to implement it in your own code. As an example, I'll show you some code that uses the factory method pattern to automate a plastic toy factory.

C# Design Patterns

Buy nowLearn more

Creational and Structural Design Patterns Introduction

  • About this course
  • The Gang Of Four And The 23 Design Patterns

Creational Design Patterns

  • Section Introduction
  • Creational Design Patterns ZIP Files
  • Abstract Factory Pattern
  • Builder Pattern
  • Factory Method Pattern
  • Prototype Pattern
  • Singleton Pattern
  • Section Recap
  • Quiz 1: Creational Design Patterns

Structural Design Patterns

  • Section Introduction
  • Structural Design Patterns ZIP Files
  • Adapter Pattern
  • Bridge Pattern
  • Composite Pattern
  • Decorator Pattern
  • Facade Pattern
  • Flyweight Pattern
  • Proxy Pattern
  • Section Recap
  • Quiz 2: Structural Design Patterns

Creational and Structural Design Patterns Conclusion

  • Course Recap

Behavioral Design Patterns Introduction

  • About This Course
  • The Gang Of Four And The 23 Design Patterns

Behavioral Design Patterns

  • Section Introduction
  • Behavioral Design Patterns ZIP Files
  • Chain Of Responsibility Pattern
  • Command Pattern
  • Interpreter Pattern
  • Iterator Pattern
  • Mediator Pattern
  • Memento Pattern
  • Observer Pattern
  • State Pattern
  • Strategy Pattern
  • Template Method Pattern
  • Visitor Pattern
  • Section Recap
  • Quiz 3: Behavioural Design Patterns

Behavioral Design Patterns Conclusion

  • Course Recap