bernied@yoyodyne.ncsa.uiuc.edu (Bernhard Damberger) (06/13/91)
I have a question about templates that some one might be able to help me
with. I have a linked list class that I want to define as a template. It
uses another class of nodes (I call them LinkNodes) to make up the list.
The classes look something like this:
/* The LinkNode class for the LinkedList class */
template<class Type> class LinkedList; // forward decl.
template<class Type> class LinkNode {
friend class LinkedList<Type>;
protected:
LinkNode<Type> *next; // pointer to the next LinkNode
// How does one define next???
Type *object; // the object this node contains
public:
...
};
/* The LinkedList class */
template<class Type> class LinkedList {
protected:
LinkNode<Type> * head; // head of the linked list
// How does one define head???
int order; // size or order of the linked list
public:
...
};
LinkNode needs to define an instance of a pointer to another LinkNode<Type>.
My question is what is the syntax to define such a relationship? Can one define
such a relationship? Thanks for your help...
_bernhard damberger
bernied@yoyodyne.ncsa.uiuc.edu
--------------
Disclaimer: Work...whats that?