|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
vb.net nested class' parent?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 Buchanan wrote:
Show quoteHide quote > is there an implicitly-defined Parent property defined for a class that is There isn't an implicit reference to the containing object. You will> 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 need to pass that in yourself in your nested class's constructor. -- Tom Shelton [MVP] |
|||||||||||||||||||||||