I am trying to implement an object-oriented binary tree, however, I get the error message of a call of an overloaded constructor being ambiguous. The problem is that I really do have the necessary constructor, yet C++ doesn't seem to recognize it.
My code: http://pastebin.com/PM9PDYAN
The error message:
56 36 In constructor 'Node::Node(const int&, Node*, Node*, const int&)':
56 36 [Error] call of overloaded 'Node(const int&, Node* const)' is ambiguous
17 3 [Note] Node::Node(const int&, Node*)
15 3 [Note] Node::Node(const int&, const int&, Node*) <near match>
15 3 [Note] no known conversion for argument 2 from 'Node* const' to 'const int&'
37 1 [Note] Node::Node(const int&, Node*, Node*, Node*)
Your two constructors with default arguments "overlap":
And:
Both of these could match a call with just an
int
or just anint
and aNode *
.Looks like there are other overlapping constructors as well.