Inheritance: Parent not using Child method.

Setup:

class Parent     def foo         bar()     end

    def bar         # more stuff     end end

class Child < Parent     def bar         # over riding bar     end end

obj = Child.new obj.foo

Brenton B wrote:

Why does it call Parent#bar instead of Child#bar? ... according to inheritance and method overriding Parent#bar is replaced with Child#bar ... so when Parent#foo calls some method named 'bar', should it not call Child#bar due to obj being an instance of Child??

This question will get better results on the Ruby-talk mailing lists and newsgroups.

Where am I going wrong?

What is your evidence that the parental bar() gets called? Post your question, with that addition, that to the Ruby group(s).

Hmm ... good though, I'll throw it over there.

I'm a tool ... never mind got it going ... there was a mix up with alias_method, wasn't setup the way I thought it was ... ugh.