class Mob: public Sprite{
int _HP;
virtual int getMaxHP() = 0;
bool init() override{
if(!Sprite::init()) return false;
_HP = getMaxHP();
return true;
}
}
class Zombie: public Mob{
int getMaxHP() override{
return 100;
}
}
This looks okay, Mob is abstract so you can’t ever create an instance of it. If you’re doing it this way you would need an init function in Zombie as well that calls Mob init the same way Mob calls Sprite init.
When the Zombie class calls mob init it will use the getMaxHP from the zombie class.
I may be wrong, but by the snippets you posted it seems that what might help you the most is reading a good c++ tutorial and some other good tutorials on how to design classes. Even if you think you don’t need them, check them out anyway: there’s always something new to learn if you find the right resources.