My teacher setup some skeleton code for an assignment on linked lists.
In the header, two classes are defined:
string_node
and string
In the string definition, there is a private variable mutable string_node* cursor;
Now in the actual implementation, I'm trying to use cursor as the reference to the nodes I create and want to modify. IE:
for (cursor_index = 0; cursor_index < many_nodes; cursor_index++){
cursor = new string_node(str[cursor_index]);
I'm not sure if this is proper so first of all, could anybody tell me how I'm supposed to do it if this is wrong?
I assume its wrong because I can't access the node's data and links to other nodes via cursor since its a pointer (I'd like to be able to just do cursor.data or even setup get and set methods although I'm not sure why I would need to, if somebody would like to explain that to me).
So the main issue is being able to set the node's data/links in the implementation.