Hi everyone,
So I have a class called c_Zombie. I also have a class called c_AIstates, which is an FSM for the zombie's AI.
In my zombie class, I create a pointer of type c_AIstate:
(pseudocode)
class c_Zombie
{
private:
c_AIstate *currentAIstate;
public:
...
}
it also has a pointer to the animation class as well. many of my entity classes contain pointers to their various "components".
my question is: why do I get errors when I delete my pointers in the Zombie destructor?
c_Zombie::~c_Zombie(void)
{
delete currentAIstate;
currentAIstate = NULL;
delete onAnimate;
onAnimate = NULL;
}
I'm sure that I should know the answer but I dont
also,
assuming that i actually SHOULDN'T be explicitly deleting the pointers in the Zombie's dctor, how does the memory get deleted? or should it not be deleted at all?
EDIT: okay, the program is working now - however, I know with certainty that the same issue arises if I delete an SDL_Surface* in the dstructor, and/or an onAnimate* in some other classes.
Thanks for your time!