Lecture overview -- Keyboard shortcut: 'u'  Previous page: Example of the general class pattern -- Keyboard shortcut: 'p'  Next page: An example of classes with inheritance -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Simulation of other Paradigms and Continuations - slide 6 : 43

A general pattern of classes with inheritance
The following shows a template of a function that serves as a subclass of another class
(define (class-name parameters)
 (let ((super (new-part super-class-name some-parameters))
       (self 'nil))
   (let ((instance-variable init-value)
     (define (method parameter-list)
     (define (dispatch message)
       (cond ((eqv? message 'selector) method)
             (else (method-lookup super message))))
     (set! self dispatch))
The root of a class hierarchy.
Accompanying functions for instantiation, message passing, and method lookup.