Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:39:14+00:00 2026-05-23T09:39:14+00:00

I was reading Scott Meyers’ Effective C++ (third edition), and in a paragraph in

  • 0

I was reading Scott Meyers’ Effective C++ (third edition), and in a paragraph in Item 32: Make sure public inheritance is “is-a” on page 151 he makes the comment (which I’ve put in bold):

This is true only for public inheritance. C++ will behave as I’ve described only if Student is publicly derived from Person. Private inheritance means something entirely different (see Item 39), and protected inheritance is something whose meaning eludes me to this day.

The question: how should I interpret this comment? Is Meyers trying to convey that protected inheritance is seldom considered useful and should be avoided?

(I’ve read the question
Difference between private, public, and protected inheritance as well as C++ FAQ Lite’s private and protected inheritance section, both of which explain what protected inheritance means, but hasn’t given me much insight into when or why it would be useful.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:39:15+00:00Added an answer on May 23, 2026 at 9:39 am

    Some scenarios where you’d want protected:

    1. You have a base class with methods where you know you never want to expose the functionality outside, but you know will be useful for any derived class.

    2. You have a base class with members that should be logically used by any class that extends that class, but should never be exposed outside.

    Thanks to multiple inheritance you can play around with base classes’ inheritance type and construct a more diversed class with existing logic and implementation.

    A more concrete example:

    You could create a few abstract classes that follow Design Pattern logic, lets say you have:

    Observer
    Subject
    Factory
    

    Now you want these all to be public, because in general, you could use the pattern on anything.

    But, with protected inheritance, you can create a class that is an Observer and Subject, but only protected factory, so the factory part is only used in inherited classes. (Just chose random patterns for the example)

    Another example:

    Lets say for example you want to inherit from a library class (not that I encourage it). Lets say you want to make you own cool extension of std::list<> or a “better” shared_ptr.

    You could derive protectedly from the base class (which is designed to have public methods).
    This will give you the option to use your own custom methods, use the class’ logic, and pass the logic to the to any derived class.

    You could probably use encapsulation instead, but inheritance follows the proper logic of IS A
    (or in this case IS sort of A)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading Effective C++ (Scott Meyers), and getting the error no match for operator*
I am reading Scott Meyers Effective C++ book. It was mentioned that there are
recently I've been reading through Scott Meyers's excellent Effective C++ book. In one of
I'm reading Scott Meyers' Effective C++ . He is talking about traits classes, I
While doing some casual reading I came across an interesting quote by Scott Meyers
Possible Duplicate: gcc c++ virtual inheritance problem Hi All, I am reading Effective C++
I've been reading Scott Gu's post on code first design with ASP.Net MVC 2.0
I am reading through Jon Skeet's C# in Depth, first edition (which is a
Reading Real World Haskell, on page 95 the author provides an example: myFoldl f
I was reading Scott Guthrie blog and i have encounter a sample. You can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.