jeudi 27 septembre 2018

Line 8 - error: invalid use of non-static data member 'Queue:maxQue'

I am attempting to implement a simple queue array program in C++ but I've ran into these errors.

Line 8 - error: invalid use of non-static data member 'Queue:maxQue'

Line 12 - error: from this location

Line 55 - 'intQueue' was not declared in this scope

Here is my private members in my class definition:

class Queue
{
private:
    int maxQue = 5;
    int length;
    int beginning;
    int rear;
    int intQueue[maxQue];

This is part of the function where I got the error on line 55.

void Queue::enqueue(int x, bool checkFull)
{
if(!checkFull)
{
    if(beginning == -1)
        beginning = 0;
    rear = (rear + 1) % maxQue;
    length++;
    intQueue[rear] = x;

}

Please help if you can!

Aucun commentaire:

Enregistrer un commentaire