All this function is supposed to do is count each node in the queue and return the number of nodes.
template<class SomeType>
int TemplateQ<SomeType>::Size() const
{
int numberOfChars = 0;
QueueNode<SomeType>* countPtr;
if(IsEmpty)
return 0;
while(countPtr != rearPtr)
{
countPtr = frontPtr->data;
numberOfChars ++;
}
}
I am not sure how I am supposed to traverse through the queue counting each node.
I 2 private class objects frontPtr, and rearPtr to use. am I even close on this? if more information is needed I can put it here.