In this sub-project, you will implement the nested class Double_node.
A doubly linked node contains three member variables: a value and two pointers, each of which point to another doubly linked node. Figure 1 shows a doubly linked list which contains three nodes.
Figure 1. A doubly linked list three nodes.
Double_node |
---|
+ node_value:Type + previous_node:Double_node + next_node:Double_node |
+ create( in obj:Type = Type(), in p:Double_node = nullptr, in n:Double_node = nullptr ):Double_node + value():Type + previous():Double_node + next():Double_node |
A nested class which stores an object, a pointer to the next node in a linked list, and a pointer to the previous node in the linked list.
The three member variables are:
Double_node( Type const &, Double_node *, Double_node * )
This constructor takes three arguments: a constant reference to an Type (by default, a new instance of the class Type) and two pointers to a Double_node (each by default nullptr). These are assigned to the member variables, respectively. (O(1))
This class uses the default destructor.
This class uses the default copy constructor.
This class uses the default copy constructor.
This class has three accessors, one to get each of the three associated member variables:
This class has no member functions which modify the member variables.
This class has no friends.
Because this is a nested class within a doubly-linked list class, if a local variable is to be declared to be of this type, the following notation must be used:
typename Containing_class_name<int>::Double_node local_variable;