Hey, what things do I need to be aware of, whileI'm using vectorsa vector of pointers to objects which are dynamically allocated. And yes, the class'sThese objects which I'm storing are derived from another type.
Can you tell those things which I should know to avoid memory leaksa base class, and are being dynamically allocated and stored.
Thanks
EDIT: My bad For example, I didn't specify what language I'm using. Btw, I'm using C++
I'm having a vectorhave something like this:
vector<Enemy*> Enemies;
and I'll be deriving from the Enemy class and then dynamically allocateallocating memory for the derived class and push them in the vector of base class pointers, like this:
enemies.push_back(new Monster());
What are things I need to be aware of to avoid memory leaks and other problems?