From: gabriele renzi Date: 2004-06-23T18:53:08+09:00 Subject: Re: A question about Class and Object il Wed, 23 Jun 2004 12:39:34 +0900, "Mehr, Assaph (Assaph)" ha scritto:: > >> All other classes are an instance of Class (Object is an instance of >Class). >> What about Class? >> It's an instance of itself, right? > >"Class" is an object, whose class is Class. :-) > >> To test this strange thing, I tried to subclass Class but it failed. >> class MyClass < Class >> end >> =>TypeError: can't make subclass of Class > >That is because you're trying to extend the concept of Class-ness, not >of a particular class. That will be too hard to maintain, so Ruby >forbids it. actually, does really ruby forbids it? >> class My< Class >> end TypeError: can't make subclass of Class from (irb):1 >> My=Class.new(Class) => My >> My.superclass => Class >> My.new TypeError: wrong instance allocation from (irb):7:in `new' from (irb):7 strange behaviour :-)