Enum ClassModuleSemanticFlags
The semantic flags of a class module: facts about the objects of the class (MS-VBAL §5.2.4).
[Flags]
public enum ClassModuleSemanticFlags
Fields
DefaultInstance = 1The class has a default instance (MS-VBAL §5.2.4.1.2): its
VB_PredeclaredIdattribute isTrue, and a global variable named after the class holds an object of it, which is created the first time the name is referred to.Exposed = 8The class is accessible within the projects that reference its project, as well as within its own (MS-VBAL §5.2.4.1.1): its
VB_Exposedattribute isTrue, which the Public Not Creatable and Public Creatable instancing modes write. A module of such a project can implement the class, and Implemented does not tell of it: it is about the class's own project. Without the flag, the class is Private, the default: no other project can name it, so Implemented tells of every module that implements it.Implemented = 4Another module of the project implements the class as an interface: its
Implementsdirective names the class (MS-VBAL §5.2.4.2). The implementing module gives each member of the interface a body of its own, and does not run the code of the class's members.None = 0No flags set.
Stateful = 2The class declares variables at module level, which have object extent (MS-VBAL §5.2.3.1), or a member of it declares a
Staticlocal: each object of the class - its default instance included - holds a distinct variable of each, and keeps what its members assign to them. MS-VBA gives each object its own of aStaticlocal as well, where MS-VBAL gives a static local module extent (recorded in Excel).
Remarks
A predeclared class whose default instance is DefaultInstance and not Stateful is the usual shape of a factory: its default instance only ever makes objects of the class, and has nothing of its own to remember between two of its calls. One that is Stateful as well keeps what its members assign, in a variable every module can reach by the class's name.