11.7. Private Derivation

Public derivation implements the “Is-A” relationship between two classes by providing polymorphism and subtypes with inheritance. Private derivation, by contrast, does not support the generalization principles of polymorphism and does not perform implicit pointer/reference conversions with subtypes. Private derivation is similar to containment and represents an “implemented by” association between two classes.

Private derivation prevents access to base class data members and operations for users. This type of inheritance specializes versions of classes that do not behave like their base class in all situations. Thus, the “Is-A” relationship does not hold with private derivation.

Here is the format for private derivation. ...

Get Navigating C++ and Object-Oriented Design 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.