Here is the linked list class which is of type String:
Code:template <class T> class List { public: List(); ~List(); void clear (); void makeLink (const T &nData); T nodeData; List *next, *head, *tail; };Here I am trying to create an array of linked lists in the hash tCode:struct String { char str[MAX]; int result; int hashKey; friend ostream& operator <<(ostream& out, String& wrd); void operator= (List *head); int operator== (const String& wrd) const; int operator < (const String& wrd) const; int operator > (const String& wrd) const; }; //------------------------------------------------------------------------------ void String::operator= (List *head) { head=NULL; }
The error message I am receiving is :Code://---------------------------CONSTRUCTOR--------------------------------- template <class T> HashTable<T>::HashTable () { size=0; for (long i=0; i< MAX_SIZE; i++) htable[i]= new List<T>; <----array of linked list created ?? }
'List' : use of class template requires template argument list
see declaration of 'List'
I am not to sure how I can overcome this problem



LinkBack URL
About LinkBacks



.
If I understood you correctly the type of the hash table is : HashTable<String>.