Originally posted by: JOHNGALT99
ok , but what if I need to store mulitple items in a node, like first name last name of the person, plus there parents name ect. I am not sure how to do that.
I have a unquie number for each person to use as the key.
That's easy to do. The node object you create will have all of those as public attributes.
It's been a while since I've written code in C++, but it should look something like this:
class Node
{
public String firstName;
public String lastName;
public String parentName;
public Node *leftChildNode;
public Node *rightChildNode;
public int ID;
public Node(String firstName, String lastName, String parentName, int ID)
{
this.firstName == firstName;
this.lastName == lastName;
this.parentName == parentName;
this.ID == ID;
leftChildNode == null;
rightChildNode == null;
}
}