Type substitution (or Liskov Substitution Principle in object-oriented contexts) allows an object of a certain type (supertype, superclass) to be replaced with an object of another type (subtype, subclass). Let’s clarify the difference between subclass and subtype (and their super- counterparts) first. They are closely related, but stem from different concepts: inheritance and type compatibility. Subtype vs. Subclass Subclass is a class that inherits from another class, known as its supercl...