Can anyone provide an example of the Liskov Substitution Principle (LSP) using Vehicles?

Viewed 19324

The Liskov Substitution Principle states that a subtype should be substitutable for that type (without altering the correctness of the program).

  • Can someone please provide an example of this principle in the domain of vehicles (automotives)?
  • Can someone please provide an example of a violation of this principle in the domain of vehicles?

I've read about the square/rectangle example, but I think that an example with vehicles will give me a better understanding of the concept.

5 Answers
Related