Skip to content
Sharp

Design patterns · interview question

How does the Factory Pattern align with the Dependency Inversion Principle?

Multiple choiceMediumchapter-13-curatedpremiumdesign-patternsfactory-pattern
Choose one answer
Answer and explanation

Correct answer

C. By abstracting the object creation, it allows high-level modules to depend on abstractions.

Why

The Factory Pattern abstracts the creation of objects, allowing high-level modules to depend on interfaces or abstract classes rather than concrete implementations, thus supporting the Dependency Inversion Principle.

Test yourself on Design patterns

A free test with instant, explained results. No account needed.

Start free test
All Design patterns questions →