   Multiple Inheritance?
  Alright everyone, I'm taking on the task of writing a tile engine, and I have a set of classes and I was wondering if I'm setting up the inheritance right.class sprite //baseclass scenery : public spriteclass character : public spriteclass scAnimated : public sceneryclass scUnanimated : public sceneryclass nonPlayerCharacter : public characterclass playerCharacter : public characterclass npcAnimated : public nonPlayerCharacterclass npcUnanimated : public nonPlayerCharacterthanks   
  I would say "no".Assuming a sprite encapsulates the imagery for a given displayable object, then player characters, non-player characters, etc. "have" sprites. They are not, themselves, sprites.You might want to re-think your "is-a" versus "has-a" relationships and start again.;  I'd like to say you are too early on this, If you are doing alone, it's better to solve the interface while you are going forfard. You don't yet possibly know what you may need/not need. Keep your paths open!Inheritance in itself I consider a kind of afraiding thing. It is not healthy in big amounts.For example: you make scenery and character equal sprite, but character is not a sprite, neither sprite is the most important container it has.I don't understand the inheritance relationship between scAnimated/Unanimated.Non-&PlayerCharacter could be a good abstraction thought.What are npcAnimated and npcUnanimated?   ;  As Hunt said, make sure that you can always say that the derived class is a base class.As an example:Quote:class scenery : public spriteCan you say that scenery is a sprite?The answer is obviously no, so it should not inherit from sprite.I would suggest this--Base  --Animated    --Item   Weapon   Armor   ...    --Character   NonPlayerCharacter   PlayerCharacter   ...  --NonAnimated  ...This is just an first glance idea though, making a full hierarchy take more time and planning than I have atm.The sprite class is not going into this hierarchy in my oppinion. It is probably better to give all the NonAnimated classes a pointer to sprite, and all the Animated classes a pointer to a vector of sprites, or something like that.[Edited by - pulpfist on June 1, 2006 1:48:03 PM];  He's correct. you probably want something like this tooclass sprite;class scenery{   sprite *psprite;};this is better than #include "sprite.h"class scenery : public sprite{};because you dont have to include the sprite header unnessecarily.;  I'm not alone, there are two other people working with me, I am doing the programming though. The other two are there for storyboarding, drawing, sounds, and the like. We are going for very small, and tight, being our first big project. This is the biggest project I've tried to take on in programming.   