Factory Method Pattern
Factory Method Pattern
C# Design Patterns
Creational and Structural Design Patterns Introduction
Creational and Structural Design Patterns Introduction
Creational and Structural Design Patterns Conclusion
Creational and Structural Design Patterns Conclusion
Behavioral Design Patterns Introduction
Behavioral Design Patterns Introduction
Behavioral Design Patterns
Behavioral Design Patterns
Behavioral Design Patterns Conclusion
Behavioral Design Patterns Conclusion
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.