Difficulties with understanding linked list

Hi,

I'm trying to understand a linked list example, but get confused by the syntax. Can someone please explain the given code in detail?
Focus on the lines:
1
2
node->next = this->first;
	this->first = node;


I'm quite new to this-> and ->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

bool LinkedList::isEmpty() const{
     if(this->first == NULL){
               return true;}
return false;}

void LinkedList::insertAtFront(const string & newValue){
     Listnode *node = new Listnode(newValue); //
     if (isEmpty()) {
        this->last = node;
        }
	
    node->next = this->first;
	this->first = node;
}
The ptr_to_struct->member syntax is a shorthand for (*ptr_to_struct).member.

The this is a C++ class keyword which is a pointer to the currently operative class.
Take a read through the tutorials
http://www.cplusplus.com/doc/tutorial/
especially Classes (I) and Classes (II) -- particularly in part one there is a section on pointers, and in part two there is a section on this.

Hope this helps.
Topic archived. No new replies allowed.