[Next] [Previous] [Up] [Top] [Contents] [Index]
9 Sealing
Declaring Characteristics of Classes
A class definition may include the adjectives sealed
, open
, primary
, free
, abstract
, or concrete
. These adjectives declare characteristics of the class.
Additional restrictions on the ability to subclass classes may be imposed by define inert domain
.
- An explicitly defined class can be declared to be either sealed or open. If a class is sealed then no additional direct subclasses other than those explicitly known in the same library may be created. Thus, it is an error to define a direct subclass of a sealed class in some library other than the one which defined the sealed class, or to use
make
of <class>
with a sealed class included in the direct superclasses specified by the superclasses:
initialization argument. An open class does not prohibit such operations.
When explicitly defining a class, the default is for the class to be sealed. This may be overriden by explicitly specifying that it is open. A class created using make
of <class>
is open. There is no specified way to create a sealed class using make
.
- An explicitly defined class may be declared to be either primary or free. The default is free. It is illegal for a class to have more than one primary superclass unless each is a subclass of another. Slots defined in a primary class may be accessed more efficiently than slots defined in a free class.
- An explicitly defined class may be defined to be either abstract or concrete. The default is concrete. The superclasses of an abstract class must be abstract. The default method on
<make>
will signal an error if passed an abstract class. For an abstract class to be instantiable, it must define a method on make
which delegates to a concrete subclass.
Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]
Generated with Harlequin WebMaker