Original Post
I''ve got an Entity class, and several other clases derived from it. In particular, an ItemEntity class for pickups etc. Now in my player class, I have a collision event function. One parameter is an Entity pointer for the entity the player has collided with. This needs to be an Entity class so it can support collisions with all entity types.
Now, I want a function to add an item to the player''s inventory. It takes an ItemEntity pointer. My problem is, you can''t pass an Entity class (from the collision function) to this function, because it''s the base class and doesn''t have the item stuff.
Have I got this object orientation wrong, is there a better, but still elegant way of doing this? I don''t really want to abandon the inheritance thing in favour of some entitytype enum or something.
Thanks,
Frank