Sorry... solved it myself... the tutorial Ive already read was enough... the error I did was that I didnt include the header for the base class and accidently redefined some member variables. Sorry again... stop reading. :P
-------------
I dont know if I spelled it right... maybe thats why I cant find that much info on the suibject through google. Anyways, I dont need a big fat tutorial for this, knows i theory kinda how its done.
All the sprites in my game has a position and an image:
class Sprite {
int posX;
int posY;
SDL_Surface* image;
};
However, some of the sprites represents enemies, and thus needs more parameters. Like health and strength. But the base values of a normal sprite to. This is whats called class inheritance, right? Something like this:
class Monster: public Sprite {
int health;
int strength;
};
How do you do it?