instance of a class disappearing after function ends
i know that this is a simple question, and i know that theres a simple answer, but for the life of me i cant remember how to do it. basically, i have a class (called AgentClass), and as im using a graphics library called GameX there is a function called on startup called GameInit. In this function goes all initialisation code, including where i am attempting to make a whole bunch of instances of my AgentClass class. i have a linked list type thingy in place to cycle through them all, and the pointers for this are all working fine (i have several instances created outside any function which work fine).
Basically, any instance of my class created in this function disappears as soon as the function returns. I have checked this by putting a little thing in the deconstructor which lets me know when the instance is removed - and they are being deleted at the end of the function.
currently to create an instance i do:
so... what do i do to stop them disappearing after the function returns?
AgentClass myAgent(100,100,...other params...);
thanks so much for any help, i know this is an easy question...