From: Nathan Smith Date: 2006-08-24T01:11:01+09:00 Subject: Re: Call functions of superclass On Thu, 24 Aug 2006, William Crawford wrote: > 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 # 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. > > I think that's what you are wanting. It calls the parent's 'another' > method with the exact same parameters as were passed to child's > 'another' method. If you want parameters that are different, simply > specify them as if you were calling 'Parent.another(parameter)'. (ie: > super(parameter) ) I think he's wanting to know if it's possible to call a different method of the superclass than the method that the interpreter is in. For example, class A def zoo puts "in zoo" end end class B < A def hoo super.zoo end end b = B.new b.hoo will not work -- you must explicitly define method #zoo in class B in order to call the super version of it in class A. Is there a way to make the above code work, short of defining zoo in B? I'm curious about this also. Nate