Skip to main content

For questions about Liskov substitution principle in object-oriented design.

Principle to design subtypes that are safe to substitute instead of supertype, that is code intended to work with supertype keeps functioning as expected when handling objects of subtype.

See also:

  • tag
  • Wikipedia article: Liskov substitution principle

    Substitutability is a principle in object-oriented programming. It states that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may substitute objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strong) behavioral subtyping...