;; 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 'named-object object-class '(name) '(name change-name)) (class/set-method! named-object-class 'init (lambda (this name) (object^init this) (named-object/set-name! this name))) (class/set-method! named-object-class 'name (lambda (this) (named-object/get-name this))) (class/set-method! named-object-class 'change-name (lambda (this new-name) (named-object/set-name! this new-name)))