On Fri, Dec 14, 2012 at 4:54 PM, Joz Private <[email protected]> wrote: > I'm somewhat confused about the Ruby object hierarchy. > > Every class that I define is an instance of the class Class, and Class > has the hierarchy Class < Module < Object < BasicObject. > > If I define a class A, then A has the hierarchy A < Object < > BasicObject. > > But if A is an instance of the class Class, should the superclass of A > not be Module, like in the first hierarchy above? A's class is Class, so > it would make sense to me that it should follow the top one!!
No. A is a class and as such has a hierarchy. But since everything in Ruby is an object, even classes are. An object is always an instance of a class. In this case A is an instance of Class. And Class has its own hierarchy. So you have A < Object < BasicObject L -instanceOf- Class < Module < Object < BasicObject Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- You received this message because you are subscribed to the Google Groups ruby-talk-google group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at https://groups.google.com/d/forum/ruby-talk-google?hl=en
