Sebastian Hungerecker
1/2/2009 10:50:00 AM
Sijo Kg wrote:
> Second.new
> =C2=A0 =C2=A0 =C2=A0 =C2=A0I got result as
> in First class#<Second:0xb7f61820>
> in second class#<Second:0xb7f61820>
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0So is #<Second:0xb7f61820> always means=
from where I call the
> def? I did not understand it
self is the current object (in this case the object just constructed by new=
).=20
The output of inspect does not change depending on where inspect is called=
=20
from, nor does the value of self change when you call super.
In other words: if you call self.inspect and self is an object of class=20
Second, you'll call Second#inspect which, unless overridden, will return
"#<Second:bla>", and if you call Second.new, self will indeed be an object
of class Second.
HTH,
Sebastian
=2D-=20
Jabber: sepp2k@jabber.org
ICQ: 205544826