;; This file contains excerpts from the textbook Concrete ;; Abstractions: An Introduction to Computer Science Using Scheme, by ;; Max Hailperin, Barbara Kaiser, and Karl Knight, Copyright (c) 1998 ;; by Brooks/Cole Publishing Company. This file may not be reproduced ;; or redistributed other than for use with that textbook. ;; Chapter 14: Object-Oriented Programming ;; 14.5 An Application: Adventures in the Imaginary Land of Gack (define-class 'scroll thing-class '() '(be-read)) (class/set-method! scroll-class 'init (lambda (this title) (thing^init this title))) (class/set-method! scroll-class 'be-read (lambda (this) (let ((owner (scroll/owner this)) (title (scroll/name this))) (if (scroll/owned? this) (person/say owner (list "I have read" title)) (display-message (list "No one has" title))))))