0

I have to use a function to reverse print a doubly linked list of 'items'. My teacher provided me with the implementation prototype to use, which looks like this

template <class itemType>
void List<itemType>::reversePrint(ostream &output) const

The only details he had written was "reversePrint is passed the stream to print to. The function should be void". I haven't written the code yet for the implementation, but right now I'm just curious as to how I actually CALL the function. In my application, I would call the printBackward option via a menu and it should in turn call the member function, but all I have is:

void printBackward(List<item> alist)
{
  alist.reversePrint(); 
}

because I'm not sure what should go into the parenthesis as a parameter? I've never passed an ostream before (except for operator overloads) and have no idea how to call the function properly? If I tried to compile as is it will say:

candidates are: void List<itemType>::reversePrint(std::ostream&) const [with itemType = item]

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by NathanOliver
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.