VB.
NET Access Modifiers
Visibility & Scope Reference Guide
Access Modifier Comparison Table
Modifier Same Class Derived Class Same Assembly External Assembly
Public ✔ ✔ ✔ ✔
Protected Friend ✔ ✔ ✔ ■ derived
Friend ✔ ✔ ✔ ✘
Protected ✔ ✔ ✘ ✘
Private Protected ✔ ■ same asm ✘ ✘
Private ✔ ✘ ✘ ✘
Scope Hierarchy Diagram
External Assembly (other projects) Public
Same Assembly (same project) Friend Protected Friend
Derived Class (inheritance) Protected Protected Friend Private Protected*
Same Class (current type) Private (all modifiers)
* Private Protected available from VB 15.5+
Modifier Descriptions
Accessible from anywhere — same class, same assembly, or external assemblies. Public
Public
Class MyClass Public Name As String End Class
Accessible only within the same class or structure. Most restrictive modifier. Private balance
Private
As Decimal
Accessible within the same class and all derived (child) classes, regardless of assembly.
Protected
Protected Sub Breathe() ... End Sub
Accessible within the same assembly (project). Equivalent to internal in C#. Friend Class
Friend
HelperClass ... End Class
Accessible within the same assembly OR from derived classes in any assembly. Protected
Protected Friend
Friend Sub SharedMethod()
Accessible only within derived classes in the same assembly. More restrictive than
Private Protected
Protected Friend. Private Protected Sub RestrictedMethod()
Key Rules
• Classes default to Friend if no modifier is specified.
• Class members default to Public if no modifier is specified inside a Public class.
• Private is the recommended default for fields — expose them via Properties.
• Use the most restrictive modifier that still allows your code to work (principle of least privilege).
• Private Protected is available from [Link] 15.5 (Visual Studio 2017 v15.5+).
[Link] Access Modifiers Reference · Generated by Claude