Chapter 37. Private and Protected Inheritance
FAQ 37.01 What are private inheritance and protected inheritance?
Has-a, not is-a. From the user's perspective, private and protected inheritance are semantically similar to composition, but they are very different from normal public inheritance. Thus private and protected inheritance are a lot more like “has-a” than “is-a” (more precisely, than “is-substitutable-for”). Here are the ways they are like “has-a”.
Like normal composition, private and protected inheritance cause an inner object to be contained inside the outer object. With normal composition, this inner object is called a member object. The syntax for doing this with private inheritance is different than the syntax for normal composition, ...
Get C++ FAQs, 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.