-1
我有一个包含这个类定义的报头文件中:错误:“(Class对象)”没有指定类型
class visitorlist {
struct Node {
visitor vis;
Node* next;
};
Node* head;
Node* tail;
public:
visitorlist() { //written here to have it as inline.
head = NULL;
tail= NULL;
}
~visitorlist();
int lengthvl();
void add(const visitor);
void popandexit();
void transfer(visitorlist);
void deletenode(Node*);
int refiprio();
int refioffno();
int refifloor();
visitor reravi();
bool isempty();
Node* rehead();
};
和与上述报头中的源文件包括我有:
Node* visitorlist::rehead() {
return head;
}
这会导致error: 'Node' does not name a type
。 不是功能范围上的节点吗?
visitorlist ::节点 – Borgleader 2014-12-07 16:30:56
'Node'嵌套visitorList'的'里面,所以你需要用'visitorList ::节点“,但它是一个私人类,所以名字不可见。 – juanchopanza 2014-12-07 16:31:39
但这样就足够了吗? – 2014-12-07 16:31:39