linked list

  • Thread starter Thread starter Roger Renaud
  • Start date Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top