void theStack::clear() { if (anchor->next) nukem(anchor->next);// anchor holds no key, so start from its next tos = -1; anchor = new node(); anchor->next = NULL; }
theStack::~theStack() { if (anchor->next) nukem(anchor->next);// anchor holds no key, so start from its next anchor = new node(); anchor->next = NULL; tos = -1; }
MixedNum& MixedNum::operator=(const MixedNum &other) { if (this != &other) { nukem(); copy(other); } return *this; }
void theStack::resize(int s) { cap = s; if(s < 1) throw sINVALID_SIZE; if (anchor->next) nukem(anchor->next);// anchor holds no key, so start from its next tos = -1; }
theStack& theStack::operator=(const theStack &other) { if(this != &other) { if (anchor->next) nukem(anchor->next);// anchor holds no key, so start from its next anchor = new node(); anchor->next = NULL; copy(other); } return *this; }
MixedNum::~MixedNum() { nukem(); }
parser::~parser() { nukem(); }
void theStack::nukem(node* top) { if (top->next) nukem(top->next); bye(top); // changed from !top->next }