Expression Must have Class Type?

孤人 提交于 2019-12-07 00:47:27

Your errors are a result of your class declaration:

template<typename TYPE>
class LList
{
    Node<TYPE>* front;
    LList();
    ~LList();
    bool insert(const TYPE& dataIn);
    void display() const;
};

The clue is in the error "This is inaccesible." Because you have not given any access modifiers, all of the members of this class default to private. To fix this, you just need to label the public and private sections of your class:

template<typename TYPE>
class LList
{
    public:
        LList();
        ~LList();
        bool insert(const TYPE& dataIn);
        void display() const;

    private:
        Node<TYPE>* front;
};

With this change, your code should work with or without parentheses at the end of your variable declaration for list.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!