recursive linked list function

I have this function to get an entry in a linked list but I have to make it recursive. I was wondering if anyone can help.

1
2
3
4
5
6
7
8
9
10
11
12
 template<class ItemType>
ItemType LinkedList<ItemType>::GetEntry(int position) const throw(PreconditionViolatedException)
{
   const bool able_to_get = (position >= 1) && (position <= item_count_);
   if (able_to_get) {
     Node<ItemType>* node_ptr = GetNodeAt(position);
     return node_ptr->GetItem();
   }
   
   const string message = "GetEntry() called with an empty list or invalid position."; 
   throw(PreconditionViolatedException(message)); 
} 
Topic archived. No new replies allowed.