Why Square should not extend Rectangle
Square extends Rectangle, overriding setWidth and setHeight so
both dimensions always stay equal.
Code that works on a Rectangle breaks when given a Square.
Which principle does this violate, and why?
Square extends Rectangle, overriding setWidth and setHeight so
both dimensions always stay equal.
Code that works on a Rectangle breaks when given a Square.
Which principle does this violate, and why?