I have to make a code about "Implementing of queue using objects" but I don't know what exactly do I do.
Now, I don't ask a code, just explanation.
Please help!?
I have to make a code about "Implementing of queue using objects" but I don't know what exactly do I do.
Now, I don't ask a code, just explanation.
Please help!?
Please don't throw rocks at me !
Using classes may-be?
A queue should be a FIFO type of container. It must provide means to push elements at one end of the container, and access (and remove) elements on the other end. Besides that you might need a member function to report if the queue is empty.
Using classes you'd hide the implementation details of the container itself (probably managing dynamically allocated raw memory, unless you are allowed to use STL - in which case you might just make a wrapper around std::queue) using the private keyword and only expose the interface consisting of methods such as Pop(Front), Push(Back), Front and IsEmpty.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
Yeah, that makes sense.
ThanX!
Please don't throw rocks at me !
It is a container in the standard library that would be useful in implementing a queue.
In fact, there is already a queue in the standard library, so if this was not a learning exercise, you would want to just use that (#include <queue>).
If you cannot use the standard library, then you would probably want to use a linked list or array as your internal container.