Object-oriented programming in Scheme - slide 8 : 11 |
(define (class-name parameters) (let ((super (new-part super-class-name some-parameters)) (self 'nil)) (let ((instance-variable init-value) ...) (define (method parameter-list) method-body) ... (define (dispatch message) (cond ((eqv? message 'selector) method) ... (else (method-lookup super message)))) (set! self dispatch)) self))