What is the Liskov substitution principle, and why can a square-as-rectangle hierarchy violate it?
A subtype must be usable wherever its parent is expected without breaking the parent’s behavioral contract. If a mutable rectangle promises independently settable width and height, a square that chang...