I’m trying to make sence of this tutorial on doubly linked lists.
http://www.dreamincode.net/forums/topic/53161-how-to-create-a-basic-double-linked-list/
I can’t understand this part
element* list::FirstEl = NULL; //This initialises the static element* 'FirstEl' to NULL
element* list::LastEl = NULL; //This initialises the static element* 'LastEl' to
I would say this code creates a pointer of type element with the name “list::FirstEl” and sets it to null, but the scope resolution operator makes me think there is something I still havn’t covered in C++ yet.
What’s going on here?
That’s a
staticclass member initializtion.what you have there is the initialization of the members.
The name of the variables are
FirstElandLastEl, but they are part of the class, that’s why you have to qualify their names when you define them.Just like you’d qualify method names when you’d define them.