Assert error still there...
I have tried multiple times to correct the error, but have been unable to correct it.
As for the program I'm only aware of 2 bugs.
(1) The termination (destructor) after I use the overloaded =.
Which is why I posted this thread and this thread
(2) My sort when merging the lists.prior thread
I unfortunately have not picked up on any hints from other posters or enough information to research fixes for either.
I'm fairly new to C++ so please forgive my ignorance.
I feel my logic is sound, but according to the compiler it is not.
I'm not sure what you mean by this. I thought the code provided was what you would call a copy constructor. Why is it not. All I see you showing me with your code is how to navigate to the locations I should input my own code. I do not see anything that would allow the calculations or processing to occur. Am I missing something?
>>linklist(linklist *); //copy constructor
That is not a copy constructor. See my example in your other thread.
Doesn't the equal sign require to be overloaded? My teacher is requiring us to overload it for the project. Is this redundent and meaningless or am I again just way off the mark? He stated specifically I need to create a copy constructer and an overloaded = operator to copy the link list to another. Data only nothing more. Is this not what I did.
Back to the errors. Is there a book that tells you a beginner version of how to write correct syntax to prevent this particular assert error. I read what was available in msvc++, but it wasn't to helpful.
I noticed something in my research of creating a copy constructor. It stated that unless you do a deep copy the pointers copied in you class will not be valid. How do you know if this is the case? And if it is how would I fix this?
wouldn't the red parts be the assignment of the new head and tails in the copied list? Wouldn't that mean I'm using addresses that would be valid? I'm trying to make sure the pointer issue mentioned earlier isn't the reason for the destructor crash. I believe that these locations should prevent invalid addresses from being assigned. Am I incorrect at assuming this?
link* newlink = new link;
newlink->next = head;
if (head == NULL) //this tells me I have an empty list
head = newlink;
tail = head;
head = newlink;