Question OOP-SOLID-0018
HardWhat does the Law of Demeter (principle of least knowledge) recommend?
- A.
Prefer deep inheritance
- B.
Use global variables for sharing
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
SOLID and Design Principles question
What does the Law of Demeter (principle of least knowledge) recommend?
Prefer deep inheritance
Use global variables for sharing
Sign up free to see the answer and a step-by-step explanation.
Every class should know every other class
An object should talk only to its immediate collaborators, avoiding chains like a.getB().getC().doX()