Skip to content

QuizNot attempted

Factory vs abstract factory

vehicleFactory.createFactory('air').createVehicle('helicopter'). Which pattern returns a whole family of related creators?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Abstract Factory
  • createFactory('air') returns another factory, and that factory creates a consistent family (air vehicles): a factory of factories is Abstract Factory.
  • Not Factory Method: one creator picks one concrete class, it doesn't hand back creators.
  • Not Builder: builds one complex object step by step.
  • Not Prototype: creates objects by cloning an existing instance.