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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:56:31+00:00 2026-05-26T08:56:31+00:00

I want to make two classes: an object and an object_manager, but I’m confused

  • 0

I want to make two classes: an object and an object_manager, but I’m confused about how they should see/include each other. I’ve heard that it’s forbidden for two headers to include each other and if my code dependencies has circles then it’s a bad code design and usually it should be like a hierarchy structure (town->house->furniture and furniture shouldn’t know about town existence).

But here I have the object_manager which knows and holds all the objects, and the objects should have an option to create new objects, but then they should call the object_manager which will force them to know about it existence and this will create a circle in the structure, which is bad.

It’s like one process wants to create a new process by calling the OS system calls, so the OS and the process knows about each other.

Is there a way I can implement this in the right code design, or should it just be bad sometimes?

I thought maybe the objects should have a special place where they will store all their "system calls", and the object_manager will check it from time to time, but maybe there is a better way.

  • 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-26T08:56:32+00:00Added an answer on May 26, 2026 at 8:56 am

    Use forward declaration:

    class ObjectManager;
    
    class Object
    {
    private:
       ObjectManager* m_objManager;
       ....
    public:
       ....
    };
    

    In .cpp file you can include the ObjectManager.h
    Also instead of ObjectManager make the interface which will give you more abstraction for implementation IObjectManager.

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

Sidebar

Related Questions

This is a two part question, but I want to make sure the first
I want to make two block stand side by side. In Opera, Chrome and
I want to make two tables on single screen, so that if Table A
I want to make a table that simply has two integer columns to serve
I have these two URL's I want to make available to my users: /Account/Orders
i have two strings in a php i want to make following checks in
I have two displays. I want to make a media player and I want
I have two DateTime objects: StartDate and EndDate . I want to make sure
I have two QTreeWidgetItem that are top level. I want to make the second
My search system has two main parts: index and search. I want to make

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.