Abstract function with different parameters?
I am making a small game to test my skills.
I have an Entity class, which is the base class for pretty much anything. It has a Create function which renders my 2d sprite at a given x, y. That is what is similar to each entity, but each entity is different and I need to pass data to it that defines what kind of the specific entity it is.
Sounds confusing, so I'll try to show you what I mean:
My create function would be:
char sprite_file; //filename to use to make sprite
Now that is just one Entity (Enemy is derived from Entity). Let's say I have a Player entity. The Create function would be the same, except it would be Enemy::Create (int x, int y, PlayerDefinition *def). The third parameter is different in each Entity so I don't think I can use a pure virtual function, yet what I am trying to do it seems like I should be using one - since every single Entity has a Create function. Is there a smarter way to do this?
Enemy::Create (int x, int y, EnemyDefinition *def)