Definition
The factory method pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.
Simple
1. You have a base class with an abstract method.
2. The abstract method is a factory method which returns different products.
3. The child classes implements the factory method and returns different products.
4. The base classes uses the products without knowledge of how they were created.

No comments:
Post a Comment