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 and note that there are actually two different schools of thought on the issue of how classes go about overriding inherited behavior. There is the scandinavian school of OOP, common to languages of Scandinavian origin (including the first OOP language, Simula), and the American school, common to languages of American origin.

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