Inheritance (also called subclassing, or deriving a class) was once the most heavily promoted idea in object orientation. It promised to save a lot of work.
These days, it is more controversial; programmers debate how often to use it. Near the end of the chapter, I’ll show it in the context of a carefully thought-out inheritance tree...but those take a lot of work to build an example around.
For now, we’ll look at simple uses of inheritance—including new features of C++0x that make it easier to use—and consider its more sophisticated uses later.
One of the themes of this book is reusable code. If a problem is solved once, you don’t want to solve it again. So if a class does a particular job, you ...