News for hackers. Stuff that matters.
Re:A Square Is Not A Rectangle by mattmcknight on Monday September 14, 2009 @05:14PM (#822635)
If the method isn't final, I would consider the possibility of implementation differences in subclasses. I am trying to think of a case where it would cause a problem, and most of those involve methods that probably ought to be in the Rectangle class anyway (and thus could be overridden in square).

To me the cleanest solution is :

setDimensions(height, width)

where the contract for square enforces the equality of height and width.

There are no comments on this comment yet.