Hi, what I'm trying to do is call my validate() method from inside another method but it won't compile and I'm not sure why.. I'm pretty new at this.
Here is my validate():
ListNode* validate(const Position<T>* pos) const throw(PositionInvalidException) {
Position<T>* tmp = const_cast<Position<T>*>(pos);
ListNode* tmp2 = dynamic_cast<ListNode*>(tmp);
if (tmp2.head != NULL && tmp2 == ListNode().container_)
throw PositionInvalidException("position");
else
return tmp2->head();
}
and here is where I want to call it from:
virtual Position<T>* prev(const Position<T>* pos) const throw(ListBoundaryException, PositionInvalidException) {
ListNode* tmp = validate(pos);
return tmp->prev();
}
The error it gives is:
instantiated from `Position<T>* ListDL<T>:rev(const Position<T>*) const [with T = std::string]'
and it refers to the "ListNode* tmp = validate(pos);" line.
I have no idea what the error means, Any hints or pointers would be muchly appreciated