From: Stefano Crocco Date: 2008-01-19T03:21:45+09:00 Subject: Re: Parent class cannot call child class method Alle Friday 18 January 2008, Ed Hames ha scritto: > Hi guys, > > I have the following design which is not working as I would like it > to: > > class A > def bar > raise "Base class can't do bar!" > end > > def foo > bar > end > end > > class B < A > def bar > puts "B doing bar" > end > > def foo > puts "B does this first" > super > end > end > > If I do B.new.foo I get an exception because Base class can't do bar > which is understandable. However, I want B#bar to be called. What > would be the proper way to solve this problem? > > Thanks in advance, > Edgardo It works for me. Are you sure this is the exact code you're running? Stefano