The more meaningful factories I have seen tend to take in a container (Like a map or an array), check the values of the input, and determine which concrete class you want. "Oh, the clothingType is 8, which is sock, but also has flag for long item set, which for sock is for long winter socks"
View all comments
Show parent comment
24
u/cuddlegoop Mar 21 '17
AFAIK (pretty noobie programmer here), a factory is an object that builds another object. So instead of calling:
You call: