From: Nokan Emiro Date: 2012-12-04T07:19:26+09:00 Subject: Re: changing superclass --14dae93a16635557fd04cffa2413 Content-Type: text/plain; charset=UTF-8 > > If Animal is the superclass of Dog, then why doesn't Animal's greet() > method execute? > Because imported modules go right above the current class in the ancestors chain, but it does not mean that the imported module becomes a class: >> Dog.superclass => Animal >> Dog.ancestors => [Dog, Stuff, Animal, Object, Kernel, BasicObject] >> Stuff.class => Module The goal is something like this: class A; end class B; end class C < A; end C.superclass = B # this is wrong here! This last line doesn't work, of course, but my question was how to achieve something like that what it suggests... --14dae93a16635557fd04cffa2413 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
If Animal is the superclass of Dog, then why doesn't Animal's gree= t()
method execute?

Because imported module= s go right above the current class in the ancestors
chain, but it= does not mean that the imported module becomes a class:

>> Dog.superclass
=C2=A0=3D> Animal
>> Dog.ancestors
=C2=A0=3D> [Dog, Stuff, Animal, O= bject, Kernel, BasicObject]
>> Stuff.class
=C2=A0= =3D> Module
=C2=A0
The goal is something like this:

=
class A; end
class B; end
class C < A; en= d
C.superclass =3D B =C2=A0 =C2=A0# this is wrong here!

This last line doesn't=C2=A0work, of course, but my question was how
to achieve something like that what it suggests...


--14dae93a16635557fd04cffa2413--