From: "R. Kumar" Date: 2010-02-06T02:19:42+09:00 Subject: Re: Inheritance related problem Xavier Noëlle wrote: > 2010/2/5 R. Kumar : >> If you are saying that aM() forces a call to the parent's m() and of >> course you have inherited from Father, then yes. > > Yes, my mistake, I forgot the "public Father". > >> def aM >> �super.m >> end > > Yes, indeed, but what if I need to call a specific parent's method ? > Say Parent > Child > Grandchild. Is it possible to Parent::m in > Grandchild (other than super.super.m(), if it works :-)) ? I doubt that that's possible in the way you want, since ruby is not strictly typed, so this kind of type-casting won't work. However, there could be ways using metadata- you'll have to wait for an expert to answer. Simple way: put an explicit method in class such as grandpa_a or parent_a for the one you want to call. You could reopen the class and add the method where required. Others: Since you can get public methods of an object, i think you can go up the heirarchy and get the specific method. And then pass your message to it using send. You could do a one time traversal and store a ref to the method. Surely there will be other methods. -- Posted via http://www.ruby-forum.com/.