Factory

Creates an instance of several derived classes.

  • Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

  • loose coupling by eliminating the need to bind application specific classes into code.

  • It is just a fancy name for a method that instantiates an object.

  • Its job is to create an object.

  • Real time EX: Nescafe machine - press button to get the respective output.

Factory Method

Last updated

Was this helpful?