Need help ASAP if you can
I have a project due in 2 hours that I've been working on for weeks. I'm fairly confident that the project will work after I get help with this one function. I need to overload my assignment operator (=) so I can assign a returned Set to a newly created empty Set. I'm using linked lists and nodes containing one int value per node.
Heres my deconstructor:
setNode *pTemp = head;
head = head->next;
My overloaded = operator function is this:
Set Set::operator = (const Set& S)
if(this != &S)
for(setNode *p = S.head; p != NULL; p = p->next)
newSet += p->setVal; //+= adds the value to the set
I've tried it many different ways and although theres no syntax error, I keep getting memory overflow in my main before my while loop even reads once through. Maybe I'm not deconstructing something right? Any help is GREATLY appreciate. (Man had to type this post 3 times and 90% of the stuff in it, kept hitting escape after typing the code. Too used to vi in unix =(.