Lecture overview -- Keyboard shortcut: 'u'  Previous page: Classes and objects -- Keyboard shortcut: 'p'  Next page: Example of the general class pattern -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Object-oriented programming in Scheme - slide 6 : 11

A general pattern of classes
The following shows a template of a function that serves as a class
(define (class-name construction-parameters)
 (let ((instance-var init-value)
   (define (method parameter-list)

   (define (self message)
     (cond ((eqv? message selector) method)
	   (else (error "Undefined message" message))))
Accompanying functions for instantiation and message passing.