I'm having trouble writing a Queue class using Book structures i keep getting this error where tried to assign the pointer front and rear to the next or previous link in the queue
here is my entire Queue class i have highlighted the parts that gave me the errors <AD: lines 24, 45 and 46>

struct Book{								
	char title[30];
	long dueDate;
	struct node *next;
	};

class Queue{	//Number 2
protected: 
	struct Book *front;
	struct Book *rear;
public:
	Queue(void){							//Default constructor
		front=NULL;
		rear=NULL;
	}

	void enqueue(char *str, long dueD){
		bookInsertion(str, dueD);
	}
	struct Book* dequeue (void){
		if(front!=NULL){
			return front;
			delete front;//This prevents memory leaks
			front=front->next;
		}
		else{
			cout<<"Error:Queue emtpy"<<endl;
			return NULL;
			}
	}

	void bookInsertion(char *str, long dueD){
	struct Book *node;
	node=(struct Book*)malloc(sizeof(struct Book));
	if(node=NULL){
		cout<<"Could not allocate memory!\n"<<endl;
	}
	strcpy(node->title, str);
	node->dueDate=dueD;
	if(front==NULL){
		front=node;
		rear=node;
	}
	else{
		rear->next=node;
		rear=rear->next;
	}

	}
};

Line 4: the next pointer in struct Book should be struct Book *, not struct node *

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.