A Queue Class
The first order of business is to design a Queue
class. First, you need to list the attributes of the kind of queue you’ll need:
• A queue holds an ordered sequence of items.
• A queue has a limit on the number of items it can hold.
• You should be able to create an empty queue.
• You should be able to check whether a queue is empty.
• You should be able to check whether a queue is full.
• You should be able to add an item to the end of a queue.
• You should be able to remove an item from the front of a queue.
• You should be able to determine the number of items in the queue.
As usual when designing a class, you need to develop a public interface and a private implementation.
The Queue Class Interface
The queue attributes listed ...
Get C++ Primer Plus now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.