Next: 15.6 Sendの実現
Up: 15 CLOSのクラスシステムの実現
Previous: 15.4 Instance生成
インスタンスにメッセージが送られて
メソッドを探す手続きは以下のように,
そのクラスに登録されているメソッドを探し,
なければ,その親クラスのメソッドを探すように
実現してあります.
(defun find-method* (function cls-name)
(let ((class (get-class cls-name)))
(cond
((gethash function (cls-functions class)))
(t (find-method-in-parents
function
(cls-parents class))))))
(defun find-method-in-parents (function parents)
(if parents
(cond
((find-method* function (car parents)))
(t (find-method-in-parents
function
(cdr parents))))))
generated through LaTeX2HTML. M.Inaba 平成18年5月6日