SOLID PROGRAMMING – LISKOV SUBSTITUTION PRINCIPLE

Substitutability is a principle in object-oriented programming stating 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. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strongbehavioral subtyping, that was initially introduced by Barbara Liskov in a 1987.

The Liskov Substitution Principle is the third of Robert C. Martin’s SOLID design principles. It extends the Open/Closed principle and enables you to replace objects of a parent class with objects of a subclass without breaking the application. This requires all subclasses to behave in the same way as the parent class.

Therefore:

Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.” – Robert C. Martin

A violation of this behaviour would imply your code is not SOLID and it may be prone to malfunctioning.