I need help writing code for my print function in a linked queue adt
queue.h
template <class ItemType> // record type for nodes on queue
struct NodeType
{
ItemType info;
NodeType* next;
};
template <class ItemType>
class QueueType
{
public:
QueueType();
QueueType(const QueueType &); // Copy constructor
~QueueType(); // Class destructor.
void MakeEmpty(); // Initializes the queue to an empty state
bool IsEmpty() const; // Determines whether the queue is empty.
bool IsFull() const; // Determines whether the queue is full.
void Enqueue(ItemType newItem); // Adds newItem to the rear of the queue.
void Dequeue(ItemType & item); // Removes front item from the queue and
// returns it in the parameter.
ostream & Print(ostream &); // Prints contents of queue to screen
QueueType& operator= (const QueueType &); // Function: operator=
private:
NodeType<ItemType>* front; // pointer to front node
NodeType<ItemType>* rear; // pointer to rear node
};
Print function in queue.h
//-----------------------------------------------------------------
// Function: Print - // Prints Results of queue
// Pre:
// Post: Cout << statetment of queue contants
template <class ItemType>
ostream & QueueType<ItemType>::Print(ostream & stream)
{
NodeType<ItemType>* tempPtr;
int counter = tempPtr;
stream << "The queue contains: " << endl;
while (counter != 0)
{
stream << rear[counter] << " ";
counter--;
}
return stream;
}
queueTest.cpp - This is how im trying to implement it
else if (num == 6)
{
queue.Print(QueueType<ItemType>ostream & stream);
cout << endl;
}