I want to create an array of pointers to custom objects Image, but I am not sure if I am doing it properly (and I dont have any experience with arrays of pointers). I have a constructor that takes in one image as the first element and the array size, but I don't think I have properly created an array of image pointers. I know it is probably a lot easier, but I do not want to use vectors.
In the header file, I have:
class Album {
public:
  unsigned arrmax;
  Image** imgar;
  Image basepic;
And in the cpp file I have a constructor:
Album::Album(const Image & picture, unsigned max) {
arrmax = max;
basepic = picture; //operator overloaded
imgar = new Image*[arrmax]; //array of Image pointers 
for (unsigned i = 0; i < max; i++) {
   imgar[i] = NULL;
  }
 imgar[0] = &basepic;
}
My destructor looks like this:
Album::~Album() {
if (imgar != NULL) {
for (unsigned i = 0; i < this->arrmax; i++) {
  if (imgar[i] != NULL) {
    delete imgar[i]; // delete[] or delete??
   } 
  }
 }
}
For the destructor, would I also have to do delete[] imgar as well after iterating through the elements? Or am I just not deleting the right things?
 
     
    