- Feb 13, 2003
- 26,252
- 403
- 126
I have a class called TreeNode with a function called getLeft() and a function called getRight(), which returns the left sibling and right sibling of the binary tree node, respectively.
I also have a class called Tree, and a function that returns if a node is a leaf (no children). So I want to call a node's getLeft() and getRight() functions. the isLeaf() method has a pointer to a TreeNode as a parameter (named "v").
The question is, how do I call v's getLeft() and getRight() methods? So far I have v->getLeft() but I'm getting an error that's so useful it's funny ("syntax error at end of input").
I'm a n00b to C++ (only had a few Java classes last year and this year) so thanks for any help. The code for the isLeaf method is below:
I also have a class called Tree, and a function that returns if a node is a leaf (no children). So I want to call a node's getLeft() and getRight() functions. the isLeaf() method has a pointer to a TreeNode as a parameter (named "v").
The question is, how do I call v's getLeft() and getRight() methods? So far I have v->getLeft() but I'm getting an error that's so useful it's funny ("syntax error at end of input").
I'm a n00b to C++ (only had a few Java classes last year and this year) so thanks for any help. The code for the isLeaf method is below: