C++ Generic Queue

I want to share with you a generic queue in C++ that I made for educational purposes. It is mainly composed by two classes as every LIFO stack (also known as Queue), first the Queue class that defines an interface for using our queue with the common methods (enqueue, dequeue, first, isEmpty,…) and finally the Node class that represents a node of information with a pointer to the next element.

In order to have a Generic Queue we need to parametrize that classes and if necessary, override the assignment method if we want to use a non primitive type queue.

Note: Implementation of methods must be in headers files instead of .cpp files otherwise we can get some compiler errors (tested in Visual Studio 2010)

Queue class code:

Node class code:

You can download the full project for Visual Studio 2010 from: GenericQueue

Tagged with: , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*