I'm writing a program for a class and I'm stuck trying to figure out how to implement the following function
private members:
stack<T*> pointers
Everytime we allocate a new array, we put a pointer to it on this stack
When the destructor is called, all the pointers in this stack are deleted.
I don't exactly know how to even start this. I imagine that the each node on the stack will have an array?
int * p = newint [3];
// p is a pointer
// p has the address of a memory block that is large enough for 3 int
p[1] = 7; // Dereferencing pointer gives access to an element in the array