GeezerVison is showing github.com — Python-Design-Patterns/05_factory at master · ahmed534/Python-Design-Patterns
Directory actions
More options
More optionsDirectory actions
More options
More optionsFolders and files
| Name | Name | Last commit message | Last commit date |
|---|
parent directory.. |
| | | |
| | | |
|
- 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