I have a question about the following code:
What does the 'Node *t=this' do? And can a list created as in the main function be used by other functions (ie you load the list in the main function and 'kill' it in another function or something)?Code:Class Node { public: Node *next; int data; Node(){ next = 0, data = 0;} //...constructor... bool Load( char *filename ) { //...open file for reading... Node *t = this; while(t->next !=NULL) { t = t->next; } while(!level.eof()) { Node *born = new Node; if(born == NULL) //...couldn't allocate, close file and return false... //...read in data... t->next = born; t= t->next; } //...close file and return true... } void Kill() { Node *t = this; if( t->next == NULL) return; t = t->next; while(t->next != NULL) { loser = t; t = t->next; delete loser; } delete t; } }; int main() { Node head; head.Load("myfile.dat"); head.Kill(); head.Load("another.dat"); head.Kill(); return 0; }