CHAPTER 6

image

Inheritance

C++ allows you to build complex software applications in a number of ways. One of the most common is the object-oriented programming (OOP) paradigm. Classes in C++ are used to provide a blueprint for objects that contain your data and the operations that can be carried out on that data.

Inheritance takes this a step further by letting you construct complex hierarchies of classes. The C++ language provides various different features you can use to organize your code in a logical manner.

Recipe 6-1. Inheriting from a Class

Problem

You’re writing a program that has a natural is-a relationship between objects and would like to ...

Get C++ Recipes: A Problem-Solution Approach 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.