next up previous contents
Next: Class `dog' Up: 2nd example of object Previous: Base class for all   Contents

Class `animal'


(define make-animal
  (lambda(aname)
    (define name aname)
    (define base-object (make-base-object))
;
    (define get-name
      (lambda()
        name))
;
    (define who-are-you
      (lambda()
        (print "error: method who-are-you not implemented")))
;
    (define self
      (lambda(msg)
        (if (equal msg 'get-name)
            get-name
            (if (equal msg 'who-are-you)
                who-are-you
                (base-object msg)))))
     self))



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz