Public Not Creatable

How one VBA project can use an object declared in the class module of another project

VisualBasicForApplications (VBA) enables one to give classes the "PublicNotCreatable" property to indicate that the class is "public" -- meaning usable by this and other projects, but instances can only be created by code within the current VisualBasicForApplications project.

(A stronger version of this is supported by a number of ObjectOriented languages: By making the constructors private, one can insure that only code within a class can create instances of that class.)

This kind of feature is typically used in SingletonPattern implementations.


EditText of this page (last edited October 6, 2014) or FindPage with title or text search