如何将实例“投射”到子类?

阿诺

我有一个类消息的实例,我将其称为“ msg”。我已经定义了一个类“ my-message”,并且希望实例“ msg”现在属于该类。

在我看来,它应该相对简单,但我不知道该怎么做。更改类给我一个我不明白的错误。

(defclass my-message (message)
  ((account-name :accessor account-name :initform nil :initarg :account-name)))

(change-class msg 'my-message :account-name account-name)

ERROR :
While computing the class precedence list of the class named MW::MY-MESSAGE.
The class named MW::MESSAGE is a forward referenced class.
The class named MW::MESSAGE is a direct superclass of the class named MW::MY-MESSAGE.
核心转储
The class named MW::MESSAGE is a forward referenced class.

前向引用的类是您引用但尚未定义的类。如果您查看类的名称,则为MW::MESSAGE我想您想继承另一个MESSAGE在另一个包中命名的类您导入的符号可能有问题。

The class named MW::MESSAGE is a direct superclass of the class named MW::MY-MESSAGE.

由于MW::MESSAGE尚未定义该类,因此无法创建它的实例。这也是为什么您无法创建其任何子类(例如)的实例的原因MW::MY-MESSAGE

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章