News for hackers. Stuff that matters.
Re:Inheritance Is Terrible by tamana on Sunday March 20, 2016 @12:19AM (#11321788)
A mutable square is not a mutable rectangle, because a mutablr rectangle can change its width independently of its length. This is the classic problem of contravariance: subtyping in the face of mutability.
Re:Inheritance Is Terrible by Bluestrike2 on Sunday March 20, 2016 @01:56AM (#11321973)
Good point. Without giving it much if any thought, I made an assumption--that the square is immutable--that probably wouldn't even be accurate in this context. In fact, it's the usual example used to talk about substitutability. Oops.