Answer the question
In order to leave comments, you need to log in
What is wrong here (constructor)?
Hello
class code:
class Queue{
private:
struct Node
{
String str = "123";
Node* next;
};
enum{
Q_SIZE = 10
};
int items;
const int qsize;
Node * front,rear;
public:
Queue(int);
bool isfull()const;
};
Queue::Queue(int qs = Q_SIZE):qsize(qs),front(nullptr),rear(nullptr),items(0){}
Answer the question
In order to leave comments, you need to log in
Error on this line:
Only front
is a pointer to a structure. In the class constructor, you pass rear
- to the constructor .
There will be no error if both values are pointers:int (nullptr)
Node *front, *rear;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question