I am trying to make sure that I delete all memory allocations from the new command, ran into 1 problem and I'm not sure If I understand when how the delete in a destructor of a class will be called.
Problem: I create a class in main, after the game loop I call the delete class just before return 0, it locks the program, when I coment it out, shuts down fine.
Coming form java, I have an understanding of delete and new, but I'm sure it works different in c++, when is a destructor of a class called? For example, I creating a vector of pointers to a class, this class will conatain image, and some data, in that destructor I'm going to delete the image, but I don't think it would be a good Idea to put a delete this in the destructor, is that correct? I'm assuming that when I pop a vector, that will make the pointer no longer valid, is this where the destructor gets called?
guess i'll stop here with the questions, maybe answers to some of the above will clear others up.
thanks in advance.