Using delete to clear a STL vector

Folks,

I've created 2 classes, called TEST1 and TEST2. In TEST1, I've declared a STL vector of the TEST2 class. Each time my program is run, there is a random number generated which specifies the number of instances of TEST2 that should be contained within the vector. That obviously required a initialisation function which I've written below

You're apparently not aware of what this code does. You allocate memory for a TEST2 object and initialize it. Then, you put a copy of that object into the vector. The vector automatically allocates memory to hold it. Then you start the next iteration, thus losing the pointer to the memory you just allocated and creating an irrecoverable memory leak.