Visual Basic .NET Language Modifiers


Example

Modifiers are a way to indicate how external objects can access an object's data.

  • Public

Means any object can access this without restriction

  • Private

Means only the declaring object can access and view this

  • Protected

Means only the declaring object and any object that inherits from it can access and view this.

  • Friend

Means only the delcaring object, any object that inherits from it and any object in the same namespace can access and view this.

Public Class MyClass
    Private x As Integer

    Friend Property Hello As String
  
    Public Sub New()
    End Sub

    Protected Function Test() As Integer
        Return 0
    End Function
End Class