Which design pattern can be used to create a family of dependent objects?
-
Factory Method
-
Prototype
-
Builder
-
Abstract Factory
-
Singleton
D
Correct answer
Explanation
The Abstract Factory pattern is specifically designed for creating families of related or dependent objects without specifying their concrete classes. When you need multiple objects that work together as a family, Abstract Factory provides a consistent interface for creating them. Factory Method creates single objects, Prototype clones existing objects, Builder constructs complex objects step-by-step, and Singleton ensures only one instance exists - none of these handle families of dependent objects.