Hi there,
Just a few comments, haven't studied your code thoroughly:
1 2
|
void list::Delete() { // free memory allocated with new,
}
|
This isn't doing anything at all.
You'll need to do
delete
on the dynamically allocated memory.
Note that when you just delete the list pointers, the actual data those pointers point to will still be there.
You will need to use a for-loop traversing the list, deleting the actual data first and then deleting the pointer to it.
If you don't do this, you'll have data in memory which you cannot access any more, because the pointers to it are gone.
1 2 3 4 5 6
|
list& list::operator=(list& l) {
if(&l != this) { // if there is created any object but l
Delete(); //delete and call fuction copy that copies
Copy(l); // object l?
}
return *this; // return l ?
|
This is not returning l - it's returning a pointer to a pointer to the current object.
this
is a pointer to the current object, so it should suffice.
All the best,
NwN