template<typename T>
class CLinkedListBase {
public:
typedef T type;
class Node {
public:
type data;
Node* next;
Node(void);
Node* add(string);
};
private:
Node* root;
Node* conductor;
int c;
public:
CLinkedListBase(T i=T());
int add(string);
int remove(string);
int print(void);
int fprint(string);
int size(void);
string peek(void);
void next(void);
void reset(void);
bool valid(void);
~CLinkedListBase(void);
};
Assuming I already have all of the member functions implemented elsewhere in the file, how can I fix this code so that it works properly?
I kind of need that function to return a Node pointer...
The compiler may not know that CLinkedListBase<T>::Node is a type so add typename before it: typename CLinkedListBase<T>::Node* CLinkedListBase<T>::Node::add(T i)
Notice that in your class the prototype has a string parameter, here you have a T parameter