전화

2014-10-13 3 views
0

에 대한 일치하는 기능은 내가에서 contains 전화를 시도하고전화

template <typename DataType> 
class BST 
{ 
private: 
    struct BinaryNode 
    { 
     //variables 
    } 
public: 
    BinaryNode *root; 

    int contains(const DataType &x, BinaryNode *&t) const; 
} 

포함하는 .h 파일이 없습니다 :

void SequenceMap::merge(BST<SequenceMap> theMap) 
{ 
    theMap.contains(this, theMap.root); 
} 

contains의 구현은

template <typename DataType>int BST<DataType>::contains(const DataType &x, BST<DataType>::BinaryNode *&t) const 
{ 
//some stuff 
} 

I입니다 말하는 문제가 있습니다 : no matching function call to BST<SequenceMap>::contains(SequenceMap* const, BST<SequenceMap>::BinaryNode*&) at theMap.contains(this,theMap.root)

나는 thisDatatypeSequenceMaptheMap.rootBinaryNode 인의 변수이기 때문에 잘못이의 어떤 부분이 확실하지 않다. 나는 그것을 *theMap.root으로 변경하려고 시도했지만 도움이되지 않습니다.

+1

'BST 'BST에 대한 템플릿 선언은 어디에 있습니까? 당신은 실제로 **'template ' **'class BST {// ...' –

+0

@ πάνταῥεῖ 실제로 jaba10이 코드 하이라이팅을 추가하고 대문자로 표기했습니다. 나는 개정 2에서 보았 듯이 BST 위에 템플리트 선언을 추가 한 사람이었다. – SemicolonExpected

+1

공개 메소드 인터페이스 내부에서 개인용 유형을 사용하는 것이 좋지 않다 ... –

답변

3

이 함수는 포인터가 아니라 참조로 x를 호출합니다. 당신은 아마도 원할 것입니다 :

theMap.contains(*this, theMap.root);