Original Post
The basics are thus...
I have a big array of pointers to TILESTACK classes. If a given element is NULL, then there is no TILESTACK, and thus no objects, in that element.
A TILESTACK manages a linked list of IObj classes that are in a specific tile. It has this bit of code...
// Up in the TILESTACK class declaration...
private:
long mytile;
// Assume that it is set to the array index in which
// a pointer to this instance of this class can be found, in
// the big array of pointers.
// In the code...
void TILESTACK::removeitem(IObj* iiQ) {
. // iiQ stands for "Item In Question"
. // Finds and deletes the passed object.
delete gTilelist[mytile]; // Deletes the pointer to this instance of the class.
}
// And the TILESTACK''s destructor...
TILESTACK::~TILESTACK() {
gTilelist[mytile] = NULL;
}
I am seriously wondering if this whole crazy getup will work... can a class delete itself?