I honestly have no idea why this is happening. I checked, double-checked, and triple-checked curly braces, semicolons, moved constructors around, etc. and it still gives me this error.
Relevant code follows.
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
And 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;
}
Because on the line:
Node* BinTree::make( float d )
the type Node
is a member of class BinTree
.
Make it:
BinTree::Node* BinTree::make( float d )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With