From: "David A. Black" Date: 2009-07-17T21:05:25+09:00 Subject: Re: class.class = class --1926193751-275807507-1247832308=:7165 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-275807507-1247832308=:7165" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-275807507-1247832308=:7165 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Hi -- On Fri, 17 Jul 2009, Rubynewbie Rubynewbie wrote: > I understand that when you define a new class it卒s an instance of > Class... > > class Test > end > > So you can treat "Test" as an object and asks its class : > > Test.class > > Class > > > Is this Class itself an object ? > > Because when i do Class.class, ruby gives me 'Class' > > So is Class an instance of itself? I don卒t understand the logic behind > this :( Yes; Class is an instance of itself. Also, Object is an instance of Class... but Class is a subclass of Object. There's a bit of circularity at the top of the class/instance diagram, in other words. It's all in the interest of bootstrapping the object model into existence, so that everything fits in: classes (including Class) are instances of Class; all classes descend from Object; etc. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, September 14-17 (More info: http://rubyurl.com/vmzN) --1926193751-275807507-1247832308=:7165-- --1926193751-275807507-1247832308=:7165--