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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:40:36+00:00 2026-06-07T13:40:36+00:00

I am in the process of creating a very simple component based game engine.

  • 0

I am in the process of creating a very simple component based game engine. I have an entity class that stores a list of components to iterate through.

The entity class also stores info like name, position, scale whatever.What I need is for each component to store a reference to the entity instance that owns it. I originally tried using the “this” keyword but it doesnt work as you cannot use it in assignments.

void Entity::addComponent(Component *theComponent){
    components.push_back(theComponent);
    theComponent->ownerEntity = this;
}

How can the component store a pointer to its owner?

Thanks for your help!

EDIT: The component class has pretty much nothing in it as its intended to be inherited but here is its declaration:

class Entity;

class Component
{
    public:
        Component();
        virtual void Update();
        Entity *ownerEntity;
    protected:
    private:

};

When Making a component if I try and access the owner entity like so:

rotation = ownerEntity->GetRotation;

I get this error:

error: argument of type 'float (Entity::)()' does not match 'float'
  • 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-07T13:40:39+00:00Added an answer on June 7, 2026 at 1:40 pm
    rotation = ownerEntity->GetRotation;
    

    should be:

    rotation = ownerEntity->GetRotation();
    

    to call the function.

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

Sidebar

Related Questions

I am in the process of creating a very simple RTS game as a
I'm in the process of creating a class that stores metadata about a particular
I'm in the process of creating a double-linked list, and have overloaded the operator=
The Background: I have been creating a script that based on input csv's that
I'm creating a very large XML file (700mb +) that process large amounts of
Suppose that a process is creating a mutex in shared memory and locking it
I am in the process of creating an iPhone app that requires to interact
I am in the process of creating a site that i would like to
I'm in the process of creating a metasearch engine and I'm stuck! Using php
I'm in the process of creating a web service that uses XML to handle

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.