Ok, I'm working on a game and I'm having problems with constructors when allocating arrays of object, so I decided I'd make a generic linked list structure to get around it. So far I've got the specification written:
Code:
#ifndef MYLIST2_H
#define MYLIST2_H
template <class T>
class mylist;
template <class T>
class node {
private:
node(T,node*);
node* next;
T data;
friend class mylist<T>;
};
template <class T>
class mylist {
private:
node *head, *cursor;
public:
mylist();
~mylist();
void addtoend(T);
void addtostart(T);
void remove();
void addbefore();
void clear();
};
#endif
This looks good to me, but when I compile it I get a 'syntax error before '*'' on this line:
Code:
node *head, *cursor*;
What am I doing wrong?