From: Isak Date: 2006-08-24T01:45:08+09:00 Subject: Re: Call functions of superclass Julian 'Julik' Tarkhanov wrote: > > On 23-aug-2006, at 17:39, James Edward Gray II wrote: > >> Try the correction above. ;) > > Actually I am curious to know: > > class Parent > def something > end > > def another > # do foo > end > end > > class Child < Parent > def something > super.another # call _another_ instance method BUT of the > superclass, not one's own > end > > def another > # do bar instead of foo > end > end > > is that at all possible somehow? Just out of curiosity. Don't have too much exposure to Ruby myself, but spent some time on #ruby-lang asking getting answers to this and the OP's questions a couple of days ago. AFAIK 'super' simply invokes the overriden method, so your example would be calling the method 'another', on whatever object is returned by Parent::something(). I don't think there's any way to refer to an object as if it had the base classes' type, but you can alias the method before overriding it: class Child < Parent def something old_another end alias :old_another :another def another # overriding the old one end end Isak > --Julian 'Julik' Tarkhanov > please send all personal mail to > me at julik.nl > > >