template<class Type>
Type* unorderedLinkedList<Type>:: newSearch(nodeType<Type> *head, const Type& x)const
{
if (head == NULL)
return 0;
if (head->info == x)
return ???(head or *head?);
return newSearch(head->link, x);
}
template <class Type>
Type* unorderedLinkedList<Type>::recursiveLinkSeqSearch(const Type& item) const
{
nodeType<Type> *current;
current=this->first;
return newSearch(current, item);
}
이제이 질문에 대한 어리 석을 느끼지만이 함수의 반환 값을 알 수 없습니다. 주 코드에서 나는 bool 같은 것을 돌려 줄 필요가있다. 메인은 비슷한 모양입니다.ADT를 사용하여 적절한 반환 값을 가져올 수 없습니다.
unorderedLinkedList<classType> l1;
classType *st;
l1.recursiveLinkSeqSearch(st);
if(l1){}else{};
필자는 기능에 많은 변화를 주었고 실제로 어떤 도움을 주셔서 감사합니다.
가 반환 헤드 있어야한다 보인다 데이터 유형의 문제를 해결. 어떤 오류 메시지가 나타 났습니까? – Shiping
"nodeType * –
유형의 값이있는 반환 유형 객체 'dataType *'을 초기화 할 수 없습니다."Type * unorderedLinkedList:: newSearch (nodeType * head, const Type & x) const "를 변경하는 방법은 다음과 같습니다. "형식 * unorderedLinkedList :: newSearch ( * head, const Type & x) const"그냥 noteType을 제거하십시오. –
Shiping