预期的不合格ID错误,最有可能导致?

时间:2013-09-02 12:42:48

标签: c++

我收到以下错误:

ListIterator.cpp:6:错误:'using'之前的预期unqualified-id make: * [ListIterator.o]错误1

编译链表程序时。任何想法最可能的原因是什么?它不应该是IntNode.h / .cpp文件中基于范围的问题。

// ListIterator.h

#include "IntNode.h"
//#include "nullptr.cpp"

class ListIterator {
    private:
        IntNode* pointer;
    public:
        ListIterator( IntNode* );

    int& operator*();

    ListIterator& operator++();

    bool operator!=( ListIterator liter );

}



// ListIterator.cpp

#include "ListIterator.h"
//#include "nullptr.cpp"

using namespace std;

    ListIterator :: ListIterator( IntNode* init = nullptr ) : pointer( init ) {};

    int& ListIterator :: operator*() {
        return pointer -> getInt();
    };

    ListIterator& ListIterator :: operator++() {
        pointer = pointer -> getNext();
    };

    bool ListIterator :: operator!=( ListIterator liter ) {
        return pointer != liter.pointer;
    };

1 个答案:

答案 0 :(得分:3)

// ListIterator.h

#include "IntNode.h"
//#include "nullptr.cpp"

class ListIterator {
    private:
        IntNode* pointer;
    public:
        ListIterator( IntNode* );

    int& operator*();

    ListIterator& operator++();

    bool operator!=( ListIterator liter );

};
你忘记了“;”最后