class bst
{
private:
typedef struct nod
{
int data;
nod* left;
nod* right;
nod(int key):data(key),left(NULL),right(NULL){}
}node;
node* root;
public:
void create();
void add(int key,node*curr=root);
void c2ll();
void print(){}
The code doesn't compile... I get the below errors.
ain.cpp: In function ‘int main()’:
main.cpp:7:12: error: call to ‘void bst::add(int, bst::node*)’ uses the default argument for parameter 2, which is not yet defined
bt.add(50);
^
In file included from bst.cpp:1:0:
bst.h:14:8: error: invalid use of non-static data member ‘bst::root’
node* root;
^
bst.h:19:28: error: from this location
void add(int key,node*curr=root);
^
bst.h:14:8: error: invalid use of non-static data member ‘bst::root’
node* root;
^
bst.cpp:10:34: error: from this location
void bst::add(int key,node* curr=root)
Any suggestions would be welcome...I am trying to avoid writing a wrapper method and instead use the default functionality provided by c++