Exercise 44. Inheritance Versus Composition

Image

In the fairy tales about heroes defeating evil villains there’s always a dark forest of some kind. It could be a cave, a forest, another planet, or just some place that everyone knows the hero shouldn’t go. Of course, shortly after the villain is introduced, you find out, yes, the hero has to go to that stupid forest to kill the bad guy. It seems the hero just keeps getting into situations that require him to risk his life in this evil forest.

You rarely read fairy tales about the heroes who are smart enough to just avoid the whole situation entirely. You never hear a hero say, “Wait a minute, if I leave ...

Get Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World of Computational Thinking with Code, Third Edition, Video Enhanced Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.