Please send questions to
st10@humboldt.edu .
/*----------------------------------------------------------
a string_node is a class:
string_node(string value)
...representing a node in a singly-linked list of string values,
each with:
a value (the string value in that node), and
a pointer to the next string_node in the list.
template for a function with a string_node parameter
a_string_node:
ret_type process_string_node(string_node a_string_node)
{
return ...a_string_node.get_value()...
...a_string_node.get_next()...
}
--------------------------------------------------------------*/
#include <iostream>
#include "string_node.h"
using namespace std;
// constructors
string_node::string_node(string a_value)
{
value = a_value;
next_ptr = NULL;
}
string_node::string_node()
{
value = "";
next_ptr = NULL;
}
// selectors
string string_node::get_value() const
{
return value;
}
string_node* string_node::get_next() const
{
return next_ptr;
}
// modifiers
void string_node::set_value(string new_value)
{
value = new_value;
}
void string_node::set_next(string_node *new_next_ptr)
{
next_ptr = new_next_ptr;
}