20-CS-122-001 Computer Science II Spring 2012
Queue classes with header files, ready for library

Virtual functions, classes, inheritance, lists, queues, stacks, applications

Array implementation:
    queue_a.h     Header file
    queue_a.cc     Compilable code
    queue_a_use.cc     Example use
Linked list implementation:
    queue2.h     Header file
    queue2.cc     Compilable code
    queue2use.cc     Example use

How to compile:

Command Description
g++ -c queue2.cc Compiles and assembles the library functions to object code (queue2.o)
g++ -c queue2use.cc Compiles and assembles (to queue2use.o) an application which uses the library function
g++ queue2.o queue2use.o -o q2     Links the library code with the application

Notes:

The object code queue2.o need be compiled once and saved as a library file to be used in numerous and various applications without modification. It is almost in that form now but not quite. We will leave library management to a later course. Once a library module, queue2.o (now queue2.so for statically linked object) is placed in a library directory such as /usr/lib on a unix box and the include file queue2.h is placed in a convenient location for include files such as /usr/include. Then applications should use #include < queue2.h > instead of #include "queue2.h".

PowerPoint:   Queues

Java Demo:      Minimize Hops Visualizations