Declaration problem

  • Thread starter Thread starter Soske
  • Start date Start date
S

Soske

Hi

I'm creating binary tree and i have my own structure with variables parent,
leftchild, rightchild:

Public Structure Node
Public Parent As Object
Public LeftChild As Object
Public RightChild As Object
 
Soske said:
I'm creating binary tree and i have my own structure with
variables parent, leftchild, rightchild:

Public Structure Node
Public Parent As Object
Public LeftChild As Object
Public RightChild As Object
.
.
.
End Structure

I need to hold only references to objects in teese variables.

Notice that structures are value types.

Use something like this instead:

\\\
Public Class Node
Public Parent As Node
Public LeftChild As Node
Public RightChild As Node
End Class
///
 
Back
Top