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]

in main you would do

intList.reversePrint(cout);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.