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 9271715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:41:19+00:00 2026-06-18T15:41:19+00:00

I have a project going with multiple levels of inheritance. It goes like this

  • 0

I have a project going with multiple levels of inheritance. It goes like this

XMLs -> Entity -> Item and then there are numerous item classes that inherit from Item which then inherit from Entity. Now, I have each class defined as shown

    class Entity: public XMLs
    {
     public: 
            Entity() {}
            virtual ~Entity() {};
         //other functions
    };

This is the one that is giving me trouble. Whenever I try to create an Item object or any type of object at all really in my main function, it gives me the following error

/usr/include/c++/4.6/ostream: In constructor ‘Entity::Entity()’:
/usr/include/c++/4.6/ostream:363:7: error: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream() [with _CharT = char, _Traits = std::char_traits]’ is protected

What does this mean? Everything I google about constructors and protected involves the keyword protected where I have public.

  • 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-06-18T15:41:21+00:00Added an answer on June 18, 2026 at 3:41 pm

    Read the message again It doesn’t say your constructor is protected, it says std::basic_ostream‘s constructor is protected. Your class (or a parent thereof) has a std::basic_ostream (or maybe std::ostream) member, which cannot be default-constructed. You must construct it with an argument. This page shows that it must be cosntructed from a basic_streambuf<Elem, Tr>*.

    Now I’m going to extrapolate: You probably don’t actually want a std::ostream member in your class, you probably want a specific-derived type, or you want a reference, or (most likely) a an unknown or changable derived type. But since the nieve way to address the first two cases makes your class non-copiable, the final solution is virtually always the same: Use a std::unique_ptr<std::ostream> instead if your class owns the stream, or a std::ostream* if someone else owns it.

    Finally: The full text for errors is in the “output” window of Visual Studio, not in the “Error” Window, which just shows summaries. The full text of that error would have many more details about the error, including (most likely) the name and line number of your class’ default constructor.

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

Sidebar

Related Questions

So I have a project where there is some automatic initialization going on through
The project I have going uses multiple walls for discussion that are created by
So I have this application that would have multiple modules, from project management to
This isn't a super critical issue, but in my project, I have multiple targets
Say I have got code for a project spread across multiple files. Is there
I have a big project going on my company where i have to develop
I have a project which is going to be share with different clients. The
I have a basic GWT Maven project going. I added SmartGWT and started playing
I have a school project in which we're going to write a financial engine
I'm going to have to write a number of vba modules for a project

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.