Multiple Inheritance

C++ allows a class to inherit from more than one superclass using a feature called multiple inheritance. Multiple inheritance is a controversial feature that always provokes strong arguments. Many programmers believe that multiple inheritance is not only unnecessary but even dangerous—though there are probably just as many who think it is an essential tool and that it can be used wisely.

Inheritance represents a relationship between classes often called “is a.” For instance, aPersistentTapeExternalInterface is anExternalInterface with additional features.

Aggregation, the use of objects as member variables, as aController uses anAccumulator, represents a relationship between instances called “has” (when the instance owns ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION 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.