R
Roger Renaud
I try to implement a "linked list" with an ADD method to add at the end of
the list an it looks like the followings. I'm new in OOP. I know it does
not work
because LIST is not an instance, but I don't know how to write it
corrrectly.
Thank's Roger.
Sub Main()
Dim List As NodeList
List.Add("XXX", Nothing)
End Sub
Public Class NodeList
Private NodeData As Object
Private NextNode As NodeList
Public Sub New(ByVal oData As Object, ByVal oNode As NodeList)
NodeData = oData
NextNode = oNode
End Sub
Public Sub Add(ByVal oData As Object, ByVal oNode As Object)
Dim Node As New NodeList(oData, oNode)
NodeData = oData
NextNode = oNode
End Sub
End Class
the list an it looks like the followings. I'm new in OOP. I know it does
not work
because LIST is not an instance, but I don't know how to write it
corrrectly.
Thank's Roger.
Sub Main()
Dim List As NodeList
List.Add("XXX", Nothing)
End Sub
Public Class NodeList
Private NodeData As Object
Private NextNode As NodeList
Public Sub New(ByVal oData As Object, ByVal oNode As NodeList)
NodeData = oData
NextNode = oNode
End Sub
Public Sub Add(ByVal oData As Object, ByVal oNode As Object)
Dim Node As New NodeList(oData, oNode)
NodeData = oData
NextNode = oNode
End Sub
End Class