Problem Statement
When do you prefer Abstract Factory over Factory Method?
Explanation
Abstract Factory creates related products that are meant to be used together, like themed UI widgets. One switch changes the entire set coherently.
This prevents mismatched combinations and centralizes the family choice at construction time.
Code Solution
SolutionRead Only
interface UIFactory { btn(): Button; input(): TextBox }
class MacFactory implements UIFactory { /* returns Mac widgets */ }