F
FlashMerlot
How to access a property of the PARENT custom class instance from a CHILD
custom class instance.
Simply as a convenience for discussion ... let's assume
A Mammal has teeth
Teeth are an array of Tooth's
From inside one instance of the TOOTH class ...
... how do I get access to a property (Carnivore)
in the MAMMAL class?
'-------------------------------------------------------------
Public Class Mammal
Private myTeeth As New Teeth()
Public Sub New()
End Sub
Private pCarnivore As Boolean = False
Public Property Carnivore() As Boolean
Get
Return pCarnivore
End Get
Set(ByVal value As Boolean)
pCarnivore = value
End Set
End Property
End Class
'-------------------------------------------------------------
Public Class Teeth
Private myTooth() As Tooth
Public Sub New()
End Sub
End Class
'-------------------------------------------------------------
Public Class Tooth
Public Sub New()
End Sub
Private pLngth As Integer
Public Property Lngth() As Integer
Get
Return pLngth
End Get
Set(ByVal value As Integer)
pLngth = value
End Set
End Property
===================
so right here ...
inside this instance of Tooth class ...
... how can I discover if the parent Mammal is a Carnivore?
===================
End Class
'-------------------------------------------------------------
custom class instance.
Simply as a convenience for discussion ... let's assume
A Mammal has teeth
Teeth are an array of Tooth's
From inside one instance of the TOOTH class ...
... how do I get access to a property (Carnivore)
in the MAMMAL class?
'-------------------------------------------------------------
Public Class Mammal
Private myTeeth As New Teeth()
Public Sub New()
End Sub
Private pCarnivore As Boolean = False
Public Property Carnivore() As Boolean
Get
Return pCarnivore
End Get
Set(ByVal value As Boolean)
pCarnivore = value
End Set
End Property
End Class
'-------------------------------------------------------------
Public Class Teeth
Private myTooth() As Tooth
Public Sub New()
End Sub
End Class
'-------------------------------------------------------------
Public Class Tooth
Public Sub New()
End Sub
Private pLngth As Integer
Public Property Lngth() As Integer
Get
Return pLngth
End Get
Set(ByVal value As Integer)
pLngth = value
End Set
End Property
===================
so right here ...
inside this instance of Tooth class ...
... how can I discover if the parent Mammal is a Carnivore?
===================
End Class
'-------------------------------------------------------------