the title describes the problem. here's how the code looks like:
#include <cstdio>
class example
{
public:
class node
{
public:
int value;
node *left, *right;
};
node *root;
example (int a)
{
root=new node;
root->value=a;
}
// HERE'S THE PROBLEM:
void function (node *variable=root)
{
}
};
int main()
{
}
g++ returns:
p.cpp:13: error: invalid use of non-static data member 'przyklad::root'
p.cpp:21: error: from this location
i don't want to use static... do you know what is the proper way of coding it?