Inspection Details

EncapsulatePublicField


Summary
Flags publicly exposed instance fields.
Reasoning
Instance fields are the implementation details of a object's internal state; exposing them directly breaks encapsulation. Often, an object only needs to expose a 'Get' procedure to expose an internal instance field.
The following code example(s) would trigger this inspection:

Public Foo As Long

The following code example(s) would not trigger this inspection:

Private internalFoo As Long
Public Property Get Foo() As Long
    Foo = internalFoo
End Property


Back to List