O'Reilly logo

C++ Primer Plus by Stephen Prata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required