O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Declaring Inheritance

Up until this lesson, you have been using C++ as an object-based language. To be truly object-oriented, a language must be able to support inheritance.

Inheritance is the ability to create a new class whose capabilities are based on at least one other class (often called the superclass or ancestor). Inheritance has been called “programming by difference,” because the only code in the new class (called the derived class or descendant) is that which differs from the superclass.

Inheritance allows you to replace or add member functions or to add member variables to an existing class by creating a derived class and putting the changes in the new class. In most cases, you can do this without modifying the superclass.

You will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required