TreeNode::Parent

Description

Find parent.

Syntax

TreeNode Parent( )

Parameters

Return

Parent node of the child node which calls this method. Returns NULL if the node is root node.

Examples

EX1

void TreeNode_Parent_ex1()
{
    Tree myTree;
    TreeNode tn1, tn2, tn3;
    tn2 = myTree.AddTextNode("abc", "node2", 2);
    tn3 = tn2.AddTextNode("efg", "node3", 3); //tn3 is added to tn2 as its child
    
    tn1 = tn3.Parent();//now tn1 and tn2 refer to the same node, which is the parent of tn3
    
    out_tree(myTree);
    out_tree(tn1);
    out_tree(tn2);
}

Remark

See Also

Header to Include

origin.h