Skip to content

Latest commit

 

History

History
 
 

05_factory

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Factory

  • A factory is a class that is responsible for creating objects of other types.
  • For example, if we were making a game and we wanted to generate different enemies randomly at runtime, we could use a factory pattern to generate these objects dynamically (all must share the same parent class "Enemy")
  • Used when you don't know ahead of time what class object you need