RDC00409: Public field
Severity: Information · Family: RDC (Rubberduck Core analyzers) ·
Raised by: EncapsulatePublicFieldAnalyzer
A class module declares a Public variable.
A Public variable of a class module is a member of its objects (MS-VBAL §5.2.3.1 Module Variable Declaration Lists).
Any code that holds an object of the class can assign it any value of its type, and the class has no say. A Property Get and a Property Let (or
Set) over a Private variable give the class a place to check the value, or to refuse it.
The finding is the name of the variable.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
A Public variable of a class module. |
Public Name As String |
Make the variable Private, and give the class a Property Get Name and a Property Let Name. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca