Which design pattern describes a component that creates objects without exposing concrete classes?

Prepare for the TJR Bootcamp Test with flashcards and detailed questions. Get hints and explanations for each query. Ace your exam!

Multiple Choice

Which design pattern describes a component that creates objects without exposing concrete classes?

The concept being tested is object creation with encapsulation. The Factory pattern provides a component that creates objects and returns them through a common interface or base type, so the caller never needs to know which concrete class is being instantiated. This hides concrete implementations and promotes loose coupling, making it easy to swap in different implementations without changing client code. The correct idea is that creation is centralized and abstracted, which is exactly what the described pattern does.

The other patterns don’t fit this description. The singleton focuses on ensuring a single instance. The observer deals with notifying interested parties about changes. The adapter changes how a class’s interface appears to a client, enabling compatibility rather than controlling object creation.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy