New Error For Me, Thanks for any help
I am attempting to get my tree setup to receive the following constructors...
Tree(Tree *, Tree *);
When I compile I get these errors....
tree.cpp: In function `int main()':
tree.cpp:252: initializer list being treated as compound expression
tree.cpp:252: invalid conversion from `uchar' to `Tree*'
tree.cpp:253: initializer list being treated as compound expression
tree.cpp:253: invalid conversion from `uchar' to `Tree*'
tree.cpp:254: initializer list being treated as compound expression
tree.cpp:254: warning: unused variable `Tree*r'
This is the only initializer list I use....
Node(unum d = 0, uchar l = '\0', Tree * ln = NULL, Tree *
rn = NULL) :
This is the main function(test code) that I am working on.
unum num = 5;
uchar let = 's';
Tree * s(num, let);
Tree * t(num, let);
Tree * r(s,t);
//cout << r->getdata() << endl;
Any ideas are appreciated and an explanation of what the error actually is as I have not seen this one before and a better understanding of what the compiler is yelling about would be valuable in the long term.
You have two options. Create a Tree on the stack or on the heap.
On the stack: Tree tree(num, let);
On the heap: Tree *tree = new Tree(num, let);
You are trying to do a mix of it =)