Please send questions to
st10@humboldt.edu .
#ifndef string_node_H
#define string_node_H
/*----------------------------------------------------------
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 <string>
using namespace std;
class string_node
{
public:
// constructors
string_node(string a_value);
string_node();
// no destructor is needed, nor the other of the "big 3";
// although pointers are involved here,
// this class doesn't, itself, do any dynamic allocation
// (verified by checking Savitch and Main's node class on
// p. 248 of "Data Structures and Other Objects Using
// C++", 3rd edition)
// selectors
string get_value() const;
string_node* get_next() const;
// modifiers
void set_value(string new_value);
void set_next(string_node* new_next_ptr);
private:
string value;
string_node* next_ptr;
};
#endif