繁体   English   中英

错误:“(类对象)”未命名类型

[英]error: '(Class object)' does not name a type

我有一个包含此类定义的头文件:

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 Node不在功能范围内吗?

采用

visitorlist::Node* visitorlist::rehead() {
    return head;
}

或者,由于C ++ 11:

auto visitorlist::rehead() -> Node* {
    return head;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM