왜 이런 일이 발생하는지 솔직히 알지 못합니다. 체크, 이중 체크, 중괄호, 세미콜론, 생성자 이동, 등등.이 에러는 여전히 나에게 있습니다.'*'토큰 앞에 예상 생성자, 소멸자 또는 형식 변환이 있습니다.
관련 코드는 다음과 같습니다. 때문에 라인
BinTree.h
#ifndef _BINTREE_H
#define _BINTREE_H
class BinTree
{
private:
struct Node
{
float data;
Node *n[2];
};
Node *r;
Node* make(float);
public:
BinTree();
BinTree(float);
~BinTree();
void add(float);
void remove(float);
bool has(float);
Node* find(float);
};
#endif
그리고 BinTree.cpp
#include "BinTree.h"
BinTree::BinTree()
{
r = make(-1);
}
Node* BinTree::make(float d)
{
Node* t = new Node;
t->data = d;
t->n[0] = NULL;
t->n[1] = NULL;
return t;
}
그것은 유용 할 것, (b)에 표시되는 컴파일러 플랫폼을 당신 '에 다시 사용하십시오. –
포함 경비원이 안전하지 않다는 것을 언급해야합니다. 대문자보다 밑줄 문자로 시작하는 이름은 컴파일러 용으로 예약되어 있습니다. 'BINTREE_H'를'BINTREE_H'로 바꾸는 것과 같은 일을해야합니다. – GManNickG