Hierarchy of standard-object and standard-class in Common Lisp

后端 未结 2 785
旧时难觅i
旧时难觅i 2021-02-14 09:15

I\'m studying Common Lisp (with Lispworks) and I\'m trying to get into class system right now. There is a class called standard-object and it is defined as

2条回答
  •  孤街浪徒
    2021-02-14 09:47

    To understand this you will need to understand the concept of meta class. The instance of a meta class is a class and the instance of a class is an object, so basically we have 3 level hierarchy.

    standard-class is a meta-class. standard-object is an instance of metaclass standard-class hence it is class. Every other user defined class by default inherits from standard-object class.

    So when you are creating a class, you are basically instantiating standard-class metaclass and this new class is inherited by standard-object class.

提交回复
热议问题