how can Object class in ruby be an instance of it’s subclass, class "Class" [duplicate]

This question already has an answer here:

I understand that every class in ruby is an instance of class “Class”. Even for Object, Kernel class.

However, I can not wrapper my head around how come Object class, which is an ancestor of class Class, can be an instance of class Class, which is it’s subclass.

irb(main):018:0* Class.ancestors

=> [Class, Module, Object, Kernel, BasicObject]

irb(main):019:0> Object.ancestors

=> [Object, Kernel, BasicObject]

irb(main):020:0> Object.class

=> Class

Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.