Next: The Default Graph Object
Up: GraphObject Attributes
Previous: GraphObject Attributes
ContainerNode is an abstract base class which serves as parent to
any node types used by container descendants. Two examples are the
ListNode class defined in List.h and the BinaryHeapNode class
defined in BinaryHeap.h.
1. Creation
There are no public constructors defined for ContainerNode.
They can only be created by inserting items into a container.
2. Operations
Figure 2.3:
Use of Iterator
void* |
info () |
Return the address of the information stored in ContainerNode.
This is useful in creating a consistent interface between
Containers
and algorithms. For example, consider the following code:
Container<int> *cp = createMysteryLinkedIntContainer();
ContainerNode<int> *cn = cp->insert(3);
const int i = cp->info(cn);
Regardless of the underlying representation, the information stored in a
node is available. When using linked container structures such as lists
or trees, it is sometimes useful to store ContainerNode
pointers for future quick reference without having to search for items.
However, If
the underlying container is an array, there is no ContainerNode
structure.
RHS Linux User
1/26/1998