MP4
Stacks and Queues
|
OrderingStructure: represents an interface for a structure that orders items placed into it. More...
#include "ordering_structure.h"
Public Member Functions | |
virtual | ~OrderingStructure () |
Destructor for the OrderingStructure. More... | |
virtual void | add (const T &theItem)=0 |
Adds the given element to the ordering structure. More... | |
virtual T | remove ()=0 |
Removes an element from the ordering structure. More... | |
virtual T | peek ()=0 |
Looks at the next element of the ordering structure, but does not remove it. More... | |
virtual bool | isEmpty () const =0 |
Determines if the ordering structure is empty. More... | |
OrderingStructure: represents an interface for a structure that orders items placed into it.
Your Stack and Queue classes will implement this interface.
|
inlinevirtual |
Destructor for the OrderingStructure.
Virtual so as to allow derived classes to override if necessary.
|
pure virtual |
Adds the given element to the ordering structure.
theItem | The item to be added. |
Implemented in Queue< T >, and Stack< T >.
|
pure virtual |
Removes an element from the ordering structure.
You may assume that this function is only called when the ordering structure is not empty.
Implemented in Queue< T >, and Stack< T >.
|
pure virtual |
Looks at the next element of the ordering structure, but does not remove it.
Implemented in Queue< T >, and Stack< T >.
|
pure virtual |
Determines if the ordering structure is empty.
Implemented in Queue< T >, and Stack< T >.