How would I overload the cout (<< ) operator in this function???
template <class T>
void Queue<T>::PrintQ()
{
cout << “The content of the array is as follows: ” << endl;
for (int i=0; i< theQ.size(); i++)
cout << theQ[i] << endl;
}
i tried to follow an example and came up with this... but i don't think this is right...
template <class T>
void Queue<T>::PrintQ()
{
cout << “The content of the array is as follows: ” << endl;
}
ostream& operator<<(ostream& os, PrintQ& theQ)
{
for (int i=0; i< theQ.size(); i++)
cout << theQ[i] << end;
return os;
}
please help... THANKS!