Factory Method


This is a pattern providing an interface to create objects in a superclass, but subclasses can alter the type of objects created.

It consists in creating objects not with a constructor, but with a method. The objects created are called products.

All returned products must have the same interface, and the return type must be specified in the creation method.

It is possible to make the factory abstract if you wish to make several implementations of it.

Applicability


META

Status:: #wiki/notes/mature
Plantations:: Creational Patterns
References:: Dive Into Design Patterns