Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Assistance Understanding This Class
Message
From
10/03/2009 04:09:42
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01386808
Message ID:
01386836
Views:
52
>>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.

Hi,
public TTreeNode left, right;
is just a shortcut for :
 public TTreeNode left;
public TTreeNode right;
i.e. just declaring two TTreeNode objects....
HTH,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform