Chapter 5. Understanding class relationships


This chapter covers:

Not long ago, I was watching a television talk show featuring actor Sven Nordin, who plays the Norwegian version of the solo theatrical performance Defending the Caveman. Nordin convincingly demonstrated the art of banging your head on a hard surface, although he did admit that it was a painful procedure.

A medical expert who was also present remarked dryly that “he shouldn’t be doing that.”

Obviously. It’s easy to understand how that kind of abuse might be bad for your brain. On the other hand, it might be a vicious cycle: the more you rattle your brain, the less you understand how bad it is.

Throwing books at yourself may be marginally better. Just watch out for ideas that are too obvious; they may knock you temporarily unconscious.

5.1. Inheritance

5.2. Object composition

5.3. Interfaces

5.4. Favoring composition over inheritance

5.5. Summary