Class ClassLifecycleInterface
The interface every class module implicitly implements: its lifecycle (MS-VBAL §5.3.1.10).
public static class ClassLifecycleInterface
- Inheritance
-
ClassLifecycleInterface
- Inherited Members
Remarks
It has two members, Initialize and Terminate, and a class handles them the way it handles the member
of any interface it implements: with a procedure named InterfaceName_MemberName, which is where
Class_Initialize and Class_Terminate come from. The class never writes an Implements Class
directive, but the interface is one of its ImplementedInterfaces like any other,
so whatever lists the interfaces a module implements - an editor building its dropdowns from the module's symbol -
finds it there, with its members, and nothing special-cases it.
The rule that a class implements every member of an interface it implements (MS-VBAL §5.3.1.9) holds for it as for any other, with no exception: each member has an implementation of its own, which is empty (DefaultImplementation), and a class that writes no handler implements the member with that one. A class that handles neither event, the common case, is therefore in no breach.
The runtime does not call the handlers by name: it dispatches the interface's member to the implementation the
class has for it (FindImplementation(VBClassModuleSymbol, VBTypeMemberSymbol)), the member's default when there is none,
which is the same dispatch an explicit Implements needs. And the interface is not a name workspace code can
refer to: nothing declares it to the scope tree, and it is no workspace symbol.
Fields
InitializeName
The name of the member that is raised once an instance has been created.
public const string InitializeName = "Initialize"
Field Value
InterfaceName
The name of the interface, and so the prefix of every handler's name.
public const string InterfaceName = "Class"
Field Value
TerminateName
The name of the member that is raised once an instance has lost its last reference.
public const string TerminateName = "Terminate"
Field Value
Properties
Initialize
The Initialize member of Interface.
public static VBTypeMemberSymbol Initialize { get; }
Property Value
Interface
The interface itself.
public static VBClassModuleSymbol Interface { get; }
Property Value
Terminate
The Terminate member of Interface.
public static VBTypeMemberSymbol Terminate { get; }