I can't seem to get multilevel inheritance function calls working properly. For my structure I have a "Entity" as the main super class then
Entity -> Bullet, Agent
Agent -> Player, Enemy
Enemy -> BasicEnemy
In each of these I have an "update" function
class Entity
{
public:
Entity();
virtual ~Entity();
//stuff
virtual Bullet update(float deltaTime);
}
class Agent : public Entity
{
public:
Agent();
virtual ~Agent();
virtual Bullet update(float deltaTime);
class Player : public Agent
{
public:
Player();
~Player();
Bullet update(float deltaTime) override;
class Enemy : public Agent
{
public:
Enemy();
virtual ~Enemy();
virtual Bullet update(float deltaTime);
class BasicEnemy : public Enemy
{
public:
BasicEnemy();
~BasicEnemy();
Bullet update(float deltaTime) override;
I create player, enemy, and bullet objects then pass them into a vector of entities however whenever I call
Entity entity = entities[i];
entity.update(deltaTime);
It only every goes into the "Agent" update function and if i make the Agent update function pure virtual it just goes to the Entity update function, why don't the player and enemy update functions overwrite the base functions?