Question OOP-SOLID-0012
MediumA ReportService creates a MySqlDatabase object directly inside its constructor. Which principle does this break, and what is the fix?
- A.
Open/Closed; make the class final
- B.
Dependency Inversion; depend on a Database interface passed in from outside
- C.
Sign up free to see the answer and a step-by-step explanation.