I am using a public outer class and a private inner class:
Code:
class List { // public outer class
class Node { // private inner class
/*
* private instance variables
*/
string dbName;
Node *link; // reference
public:
....
};
Node *head; // private instance variable
public:
List(){
head = NULL;
}
List::Node *addToStart(string new_dbName){
head = new Node(new_dbName, head);
return head;
}
.....
};
I would like to define a generic template
Code:
template <class T>
class List {
....
}
With a single class or function, template definition and use I understand. However, nested class use is generating compiler errors related to
Code:
List::Node *addToStart(string new_dbName){
head = new Node(new_dbName, head);
return head;
}
Error specifies C++ ANSI forbids Node not having a type. I do not understand this error as Node is a type itself.