Wednesday 15 August 2012

C++ Linked Lists Template Class -


I am currently practicing some link list assignments from my book and I'm stuck in the compilation of the errors implementation file It looks fine, though the header file is getting errors.

Here is my header file:

  #ifndef LINKEDLIST_H #define LINKEDLIST_H #include & lt; String & gt; using namespace std; Template & lt; Class T & gt; Class linked list {public: linked list (); LinkLink (Constant Link List and Copy); ~ Linkedlist (); Int getSize () console; Zero addEntry (T entry); Bool deleteEntry (T entry); T input point (int input); LinkLtct Operator = (Constant Linked List and Write); Private: Structure node {T data; The node's & lt; T & gt; *the upcoming; }; The node's & lt; T & gt; * Linked List = Faucet; }; #include "linkedlist.cpp" #endif // LINKEDLIST_H  

Errors from my compiler are as follows:

  c: \ users \ andym_000 \ Documents \ linkedlist \ linkedlist.h (22): Error C2059: Syntax Error: '& lt;' C: \ users \ andym_000 \ documents \ linkedlist \ linkedlist.h (20): Immediate Linked Lieutenant of Class Template; T & gt; :: node is being compiled c: \ users \ andym_000 \ documents \ linkedlist \ linkedlist.h 25): Class Template Institution 'linked list & lieutenant; T & G; ' Seeing the reference is being compiled c: \ users \ andym_000 \ documents \ linkedlist \ linkedlist.h (22): Error C2238: Unexpected token predecessor ';' C: \ users \ andym_000 \ documents \ linkedlist \ linkedlist.h (24): Error C2059: Syntax Error: '& lt;' C: \ users \ andym_000 \ documents \ linkedlist \ linkedlist.h (24): Error C2238: Unexpected token prefix ';' C: \ users \ andym_000 \ documents \ linkedlist \ linkedList.h (24): Error C2059: Syntax Error: '& lt;' .. \ linkList \ main.cpp (9): See reference to class template element 'linked list & lieutenant; T & gt; Compiling with [T = std :: string] c: \ users \ andym_000 \ documents \ linkedlist \ linkedList.h (24): Error C2238: Unexpected token predecessor ';' C: \ users \ andym_000 \ documents \ linkedlist \ linkedList.h (24): Error C2059: Syntax Error: '& lt;' .. \ linkList \ main.cpp (10): Immediate Linked Lieutenant of Class Template; T & G; ' See references to [T = int] being compiled with c: \ users \ andym_000 \ documents \ linkedlist \ linkedList.h (24): error C2238: unexpected token predecessor ';'  

im, structure node {...} isn Not a template Your errors tell you that the node & lt; T & gt; .

to do with it,

No comments:

Post a Comment