Task 1/1: Factory Method Pattern – Theory
The Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, while allowing subclasses to alter the type of objects that will be created. This pattern promotes loose coupling and ensures that the decision of object creation is delegated to the subclasses.
When to apply Factory Method pattern?
Apply the Factory Method pattern when you want to provide an abstraction for creating objects,
allowing subclasses to decide which classes to instantiate.