Metaclass Framework Reference 4-7
SOMMSingleInstance Metaclass
Description
SOMMSingleInstance can be specified as the metaclass when a class implementor is
defining a class for which only one instance can ever be created. The first call to
<className>New in C, the new operator in C++, or the somNew method creates the one
possible instance of the class. Thereafter, any subsequent “new” calls return the first (and
only) instance.
Alternatively, the method sommGetSingleInstance can be used to accomplish the same
purpose. The method offers an advantage in that the call site explicitly shows that
something special is occurring and that a new object is not necessarily being created.
SOMMSingleInstance is thread-safe.
File Stem
snglicls
Base Class
SOMClass
Metaclass
SOMClass
Ancestor Classes
SOMClass
SOMObject
New Methods
sommGetSingleInstance
Overriding Methods
somInit
somNew
Komentáře k této Příručce