老实说,我不知道为什么会这样.我检查,双重检查,三重检查花括号,分号,移动构造函数等,它仍然给我这个错误.
相关代码如下.
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
Run Code Online (Sandbox Code Playgroud)
和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;
}
Run Code Online (Sandbox Code Playgroud)
Mic*_*urr 21
因为在线:
Node* BinTree::make( float d )
Run Code Online (Sandbox Code Playgroud)
该类型Node是.的成员class BinTree.
做了:
BinTree::Node* BinTree::make( float d )
Run Code Online (Sandbox Code Playgroud)