Design Patterns · Junior · Question 28 of 75

What does the Liskov Substitution Principle (LSP) require?

Explanation

The classic violation: Square extends Rectangle, where setWidth also changes the height - code that relies on a rectangle breaks. On the frontend: a wrapper component around <input> should support expected props like onChange and disabled.

Further reading

Problem with a question

Design Patterns · Junior · question 28

Test yourself

Take the Design Patterns · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz