Dear All.

Basically I am having trouble passing my class object to myQueue. I know my Queue works as I had it working for Integers and Charachters but after approx 25hrs over 4 days I still can not get my Object to store in my Queue. Any and All help would be greatly appreciated.

As you can see on line 42 I have tryed to pass my object to the queue but with no satisfaction.

Thx

Tim

Here's a quick guess without trying to compile, look too closely...
I think because QueueElement is typedef-ed to customer * and not customer
and Tim is a customer, not a customer *.

Here's a quick guess without trying to compile, look too closely...
I think because QueueElement is typedef-ed to customer * and not customer
and Tim is a customer, not a customer *.

Winbatch, Unfortunately I tryed and it did not compile. Now currently running on 30hrs after 5 days. starting to get desperate. Can you suggest another line of attack.

Regards
Thx for the response
Tim

Do as I mentioned in my earlier post and also remove the const on the addQueue function. Also, since you are returning a QueueElement when you call Q.front(), you should ask for the name (or id, or something else). Otherwise, you need to write the operator << function for QueueElement.

cout<<Q.front().getName();

Here's what I got after making the changes above.

a - add to queue
d - display ALL
e - check if queue is empty
f - check the front value
r - remove from queue
s - delete the list
q - quit Program
a
Add Details
Add Name
BOB
TEST:BOB

a - add to queue
d - display ALL
e - check if queue is empty
f - check the front value
r - remove from queue
s - delete the list
q - quit Program
f
The front element is
BOB
a - add to queue
d - display ALL
e - check if queue is empty
f - check the front value
r - remove from queue
s - delete the list
q - quit Program


-------------------
Note there are other things that are wrong with the code. (It will crash when trying out some of the other options - you just need to work through it/debug it - I'm too lazy)

By the way, there is a MUCH better way to do this. Instead of making an array of a fixed length, you should write a wrapper around the vector class. You can have the vector hold QueueElements.

(ie:
vector<QueueElement> myVect;
myVect.push_back( Tim );
...etc..

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.