   Class Design
  I am creating a small shootem-up as an exercise, and trying to design the sprites as classes.  I want to do something like this CSprite/  \    /    \   CPlayerSprite   CEnemySpriteCan anyone give me any design ideas, and examples to learn from.  I don''t need full programs, just some example code. And if I am approaching this the wrong way advice would be helpful.Thank-you  
  Think of inheritance as an "is a" relationship. So is "The player is a sprite" a true statement? I would say no, the player is not a sprite. The player is some kind of "thing" (actor is a popular name), but it is represented as a sprite. You can say the player "has a" sprite. This is called composition, which is done by having the player and enemy classes have a CSprite member variable. The implementation of CSprite should not care that it represents a player or an enemy - but if those actors require effects specific to them then the CSprite or derived classes should implement them, not the concrete actor, so the effects can be reused elsewhere. So, have a CActor base class (that could be completely abstract, or implement some generic functionality), and derive your specialised player and enemy classes from it. These classes would initialise the appropriate CSprite object and use it to render itself into the world. Then you can do things like having an actor be represented by multiple sprites, or different kinds of sprites - whatever the concrete actor likes. It''s not restricted to being a single sprite!