As an assignment, I have been ordered to program the game Breakout/Arkanoid. We have to implement a class hierarchy starting with an Entity. We then expand this class to a PlayerEntity and an EnemyEntity. Then PlayerEntity is expanded to a PlayerBall and PlayerPaddle. EnemyEntity is expanded to EnemyBlock and EnemyProjectile. These last four classes are all expanded to have a graphical implementation with SDL.
Here is where my problem starts. I want to have a function that traverses a list of Entity's.(This can be the basic class, but more likely will be a collection of all the expanded classes) For every node in the list, I would like to call a member function of each Entity, called displayEntity(). Here is the problem. I have to give this function a parameter, but this parameter relates to SDL. This means that my basic class, Entity, should not have any knowledge of this parameter, since it should be implementation-independent. The only way I see this is work is when I make this function virtual. But in order to do that, I have to declare this function as virtual in Entity, and the parameter is needed.
I'm aware that this may be very confusing to read. I've done my best to explain it. English is not my native language, and I apologize for any mistakes I made. If you need more information, just post and ask me.
Thanks a lot for reading, and thanks even more if you could take the time to answer.
Regards
Pieter