4 ms·
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 p
by mattmcknight 17y ago
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.