From: "R. Kumar" Date: 2010-02-02T02:30:35+09:00 Subject: Re: Inheritance related problem Sean DeNigris wrote: > This is probably the same as what Rick was saying... > > If you own Parent, then the method I showed is definitely not what you > want to do. And, the solution does not require a special Ruby way, > just a refactor: > class Parent > def printa arg > puts "inside parent printa #{arg} " >> task_b arg #<-- problem solved, Parent#printa will always use the same version of printb > end > > def printb arg >> task_b arg #<-- delegate work to an extracted method > end Ok, i get it, printa should not call printb since that goes thru the inheritance chain. They should both call task_b in which the work has been factored. Thanks !!! -- Posted via http://www.ruby-forum.com/.