The factory method design pattern allows subclasses to determine which class to create. This is achieved by removing details about which class to create away from the framework. Instead, the subclasses are given the responsibility for object creation. This design pattern is useful when the framework is unaware of what is to be instantiated.
We will look at an example use case, the UML class diagram, and the source code that's necessary to implement the factory method design pattern for this scenario.