On Fri, 25 Aug 2006, ts wrote:

> >>>>> "N" == Nathan Smith <nsmith5 / umbc.edu> writes:
>
> N> Therefore, in B#hi, self.class.superclass does not refer to the superclass
> N> of B -- rather it refers to the metaclass of the super of B. If it pointed
>
>  no, not really. self.class.superclass make reference to the superclass of
>  B

It refers to the metaclass of the superclass of B -- see Programming Ruby
pp. 380-381.

> N> to the superclass of B, then calling
>
> N> self.class.superclass.hi
>
> N> would print "hi", instead of "A.hi"
>
>  no, if self.class.superclass == A then self.class.superclass.hi is the
>  same than A.hi, and ruby will print "A.hi"

Inside of a class instance method, self.class returns a reference to the
metaclass of the class. Calling superclass on the metaclass returns
another metaclass, and you're right -- it will print A.hi (as I said =])

Nate