A new classclass is defined with the define-classdefine-class macro. The syntax of define-class is close to CLOS defclass:
The metaclass option will not be discussed in this appendix.
The superclasses list specifies the super classes of class (see
for more details).
A slot description gives the name of a slotslot and,
eventually, some ``properties'' of this slot (such as its initial value, the
function which permit to access its value, ...). Slot descriptions will be
discussed in
.
As an exemple, consider now that we have to define a complex number. This can be done with the following class definition:
This binds the symbol <complex> to a new class whose instances contain
two slots. These slots are called r an i and we suppose here
that they contain respectively the real part and the imaginary part of a
complex number. Note that this class inherits from <number> which is a
pre-defined class (<number> is the super class of the <real> and
<integer> pre-defined classes)..