NextPrevUpTopContentsIndex

13.2.1 Inheritance across metaclasses

Usually an inherited class is of the same metaclass as the parent class.

For other kinds of inheritance, you need to define a method on validate-superclass which returns true when called with the respective metaclasses. For example:

(defclass mclass-1 (standard-class)
  ())
 
(defclass mclass-2 (standard-class)
  ())
 
(defclass a ()
  ()
  (:metaclass mclass-1))
 
(defmethod validate-superclass 
           ((class mclass-2) 
            (superclass mclass-1)) 
  t)
 
(defclass b (a)
  ()
  (:metaclass mclass-2))

Without the validate-superclass method, the last form signals an error because mclass-1 is an invalid superclass of mclass-2 .


LispWorks User Guide - 7 Jul 2004

NextPrevUpTopContentsIndex