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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:27:34+00:00 2026-05-19T02:27:34+00:00

I have an Entity baseclass which the classes Player and Enemy Inherit. Both player

  • 0

I have an Entity baseclass which the classes Player and Enemy Inherit. Both player and enemy contain a sprite object (From the SFML api) that looks like this:

class Player : Entity
{
   sf::Sprite sprite
}

Player and Enemy are created inside a vector which is set up like this:

class EntityManager
{
   public:
   void CollisionCheck();
   private:
   std::vector<Entity*> entityVector;
}

I’m looking to use a collision detection function which is of this form:

bool Collision::CircleTest(const sf::Sprite& Object1, const sf::Sprite& Object2)

So I’m trying to do something like this:

void EntityManager::ColCheck()
{
   if (Collision::CircleTest(entityVector[0].sprite, entityVector[1].sprite))
      {
         cout << "COLLISION\n";
      }
}

But I get this compile error:

error: request for member ‘sprite’ in

‘((EntityManager*)this)->EntityManager::entityVector.std::vector<_Tp,
_Alloc>::operator[] with _Tp = Entity*, _Alloc =
std::allocator’, which
is of non-class type ‘Entity*’

How do I pass the sprite object from these classes inside the vector to the collision function?

  • 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-19T02:27:35+00:00Added an answer on May 19, 2026 at 2:27 am

    Since entityVector holds Entity* you’ll need to use the proper syntax: entityVector[0]->sprite instead of entityVector[0].sprite.

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

Sidebar

Related Questions

I have an Entity baseclass which the classes Player and Enemy Inherit. class Entity
I have quite a complex entity structure where several classes inherit from a base
I have a whole list of entity classes which I need to make Serializable
I have two related classes which share a common interface and are both stored
I have an entity that maps to an external oracle table which is one
In my Core Data managed object model, I have an entity Foo with a
I have a collection of custom entity objects one property of which is an
Below is a sample implementation of overriding Object.Equals() for an entity base class from
I have two classes: abstract Entity , abstract ClassA extends Entity , ClassB extends
I have the following classes in my Model: public abstract class Entity : IEntity

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.