次の例では、クライアントに対して .sort() メソッドを非表示にしたいのですが、どうすればそれを達成できますか?
Namespace test
Class Figure
Implements IComparable(Of Figure)
Public Property Area As Double
Public Function CompareTo(ByVal other As Figure) As Integer Implements System.IComparable(Of Figure).CompareTo
CompareTo = Me.Area.CompareTo(other.Area)
End Function
End Class
Class Figures
Inherits System.Collections.Generic.List(Of Figure)
Public Shadows Sub Add(ByVal nieuweFiguur As Figure)
MyBase.Add(nieuweFiguur)
Me.Sort()
End Sub
End Class
Class Client
Public Shared Sub Main()
Dim figures As New Figures
figures.Add(New Figure With {.Area = 12})
figures.Add(New Figure With {.Area = 16})
'***********************************************************
figures.Sort() 'i want to hide the sort method to the client
'***********************************************************
End Sub
End Class
End Namespace