Martin DeMello wrote:
It's not a subclass, it's an anonymous proxy superclass. It goes into
the inheritance chain between the object it extends and the class that
object derived from, like so (assume a is a String):[String] --- [class << a] --- [a]
Since ruby doesn't have multiple inheritance, you can see why there can
(and need!) only be a single proxy superclass.
So, this means you lose the functionality of a? I thought the whole
point was to extend a. The tutorial
(http://www.rubygarden.org/ruby?SingletonTutorial\) actually doesn't
mention whether it is super or sub, i just assumed sub. I suppose
whether it was super or sub really doesn't matter except in what you
would be referencing by 'self' or 'super' in the added code (i.e., if
you are correct, then doing self at class scope level would allow you to
access the super class, or doing self at instance scope (in the new
code) would reference an instance of the super class. Of course, if you
used super in that context, it would reference the original class'
grandparent. Are you sure this is how it works? The tutorial doesn't
do any of the things I just mentioned, so it can't answer this question.
Thanks,
--J
···
--
Posted via http://www.ruby-forum.com/\.