vb.net nested class' parent?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

is there an implicitly-defined Parent property defined for a class that is
nested in another class? i'm looking to simplify my coding.

At this point, i've defined the class as so:

Class Item

Private _SubItem As New SubItem(Me)

'other properties and methods

Class SubItem

Private _Parent As Item

Public ReadOnly Property Parent As Item
Get
Return _Parent
End Get
End Property

Friend Sub New (value as Item)
_Parent=value
End Sub

'other stuff

End Class

End Class

Thanks,

Craig Buchanan
 
Craig said:
is there an implicitly-defined Parent property defined for a class that is
nested in another class? i'm looking to simplify my coding.

At this point, i've defined the class as so:

Class Item

Private _SubItem As New SubItem(Me)

'other properties and methods

Class SubItem

Private _Parent As Item

Public ReadOnly Property Parent As Item
Get
Return _Parent
End Get
End Property

Friend Sub New (value as Item)
_Parent=value
End Sub

'other stuff

End Class

End Class

Thanks,

Craig Buchanan

There isn't an implicit reference to the containing object. You will
need to pass that in yourself in your nested class's constructor.
 
Back
Top