16 Inheritance: What a Legacy

One of the most distinctive features of classes is subclassing, in which one class inherits the members of a previously defined class. This feature is important for several reasons.

The first reason is that subclassing lets you customize existing software. You can take a class someone else has created and add new features of your own. You can also overwrite any and all existing features of the class. Classes are therefore extensible and reusable (and that’s the last you’ll see of annoying buzzwords in this chapter, I promise).

This sounds wonderful… and sometimes it really is, but (for technical reasons I’ll cover in this chapter) things are not always that easy. For one thing, you have to revise all the constructors ...

Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.