class node
{
public:
node* left;
node* right;
node* root_;
int value;
node(int num, node* root)
{
value = num;
left = right = NULL;
root_ = root;
}
~node()
{
delete left;
delete right;
delete root_;
}
}
1 2 3 4 5
int main()
{
node root = new node(10, NULL);
return 0;
}
If I replace in the main function the code "node root = new code(10, NULL);" with "node* root = new code(10, NULL);" the error goes away. However, I don't want to create a new pointer, but an object. What am I doing wrong?