samedi 27 avril 2019

Using "<>" with an array?

I was reading through a programming book (C++ Plus Data Structures, Dale, Weems, Richard) and came across this snippet of code. This is in the section about class templates:

template <class ItemType>
class StackType{
    public:
        StackType();
        bool IsEmpty() const;
        bool IsFull() const;
        void Push(ItemType item);
        void Pop();
        ItemType Top() const;
    private:
        int top;
        ItemType items <MAX_ITEMS>;//RIGHT HERE!!
};

I'm particularly looking at the "items" attribute. I copied the code into my IDE and it did not compile.

My question: Is this an error in the book, or am I missing something?

I'm new to stackoverflow... Should I provide any more code?

Thanks for your time!

Aucun commentaire:

Enregistrer un commentaire