Introduction to OOP Chapter 16: Overriding : next previous audio real text

Downside of Replacement

The down side of replacement semantics is that there is no guarantee that the child class will have any meaning at all similar to the parent class.

For example, a child class could redefine sqrt to compute the cube root of its argument.

This goes back to the difference between subclasses and subtypes.

A refinement makes this more difficult to do, since whatever the parent does is guaranteed to be part of the child. This is why most languages use refinement semantics for constructors.

Intro OOP, Chapter 16, Slide 12