JoseM,
As the others suggest, can you be a little more specific in what you are
asking?
Do you mean a nested class?
Public Class Class1
Private Class Class2
End Class
End Class
Having Class2 nested inside of Class1 is a form of Encapsulation, I would
use this when Class2 is an implementation detail of Class1 and Class2 is not
needed anyplace else, such as the Node class of a LinkedList class, where
the Node represents the "links" in the LinkedList.
Something like (greatly simplified):
Public Class LinkedList
Private Class Node
Public Data As Object
Public Next As Node
Public Previous As Node
End Class
Private m_head As Node
Private m_tail As Node
Public Sub Add(data As Object)
Dim node As New Node
node.Data = data
node.Next = m_head
node.Previous = Nothing
m_head = node
End Sub
End Class
The Node class is nested inside of LinkedList as it is not useful outside of
the context of a LinkedList. Having Node private to LinkedList ensures that
only LinkedList is able to use the Node class.
Hope this helps
Jay