Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Assistance Understanding This Class
Message
From
10/03/2009 08:36:32
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
10/03/2009 00:14:28
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01386808
Message ID:
01386862
Views:
60
>>>>I'm trying to understand a binaray tree class. In the file is this class:
>>>>
>>>>
>>>>// Define tree nodes
>>>>public class TTreeNode 
>>>>{
>>>>   public string name;
>>>>   public double value; 
>>>>   public TTreeNode left, right;        // <-- What is this??
>>>>       
>>>>    // Constructor to create a single node 
>>>>	public TTreeNode (string name, double d) 
>>>>    {
>>>>          this.name = name;
>>>>          value = d;
>>>>          left = null;
>>>>          right = null;
>>>>    }
>>>>}
>>>>
>>>>
>>>>See comment in line. I don't understand that syntax.
>>>
>>>The TTreeNode class has left and right pointers of the same class.
>>
>>I have no idea what that means. I don't even know what to Google to read up on it.
>
>Basically a tree is a node with two branches. The left and the right are the reference to the two branches. Note that this class, the left variable, and the right variable are the same data type.

After looking at the code closer I would also like to add a public cringle that they declared the member variables as public and didn't include properties. I think Bonnie beat that into me with a stick.
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform