Define-Class

(define-class type-name-symbol parent-type-expression type-constructor predicate-name-symbol field-spec ...) -> #f

field-modifier-name-symbol may be omitted; if it is, field-accessor-name-symbol may be omitted.

define-class extends other types defined by define-class forms, adding more fields to the parent type to create a new one.

The constructor should contain the same fields as the parent type's constructor, in the same order, and before any additional fields being added for the new type.

Example: We will base this example off the one given in define-record-type, as it uses the one created there as the parent-type-expression:

(define-class point3d <point> (make-point3d x y z) point3d? (x point-z set-point-z!))
Note that we do not define point-x and point-y field specifiers for point3d, because the ones defined for point will also work on point3d's.

See Also: <object>