SE450: The FACTORY METHOD Pattern [21/55] Previous pageContentsNext page

Solution

  1. Define a creator type that expresses the commonality of all creators.
  2. Define a product type that expresses the commonality of all products.
  3. Define a method, called the factory method, in the creator type.
    The factory method yields a product object.
  4. Each concrete creator class implements the factory method so that it returns an object of a concrete product class.

Previous pageContentsNext page