Elements of OOP - Overriding

I have purposely included the category Platypus in my class hierarchy, as well as on the cover of my book, to make a specific point. A platypus is a curious animal - it is considered to be a Mammal but it nevertheless reproduces by laying eggs, instead of giving birth to live young. Thus, while we have the ``fact'' that all mammals give birth to live young, the class Platypus overrides this behavior and substites something new.

The important idea is that subclasses can, in certain circumstances, overrides the behavior that they inherit from their parent classes.

Now, the exact semantics of this overriding are a little more tricky than this simple analogy would suggest. We will, in a later chapter, examine this in more detail.

[audio] [real] Text to accompany slide29, in Chapter 1 of An Introduction to Object-Oriented Programming