From: James Coglan Date: 2009-07-21T00:45:48+09:00 Subject: Re: Issues with inheritance --001636c5bd8cf777e2046f250726 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit > The first problem I see is that when I call super.execute it seems to > want to ignore my argument and favor of the argument I gave at the > hight level of scope. (If I do str = "Robin" in Child2's execute but > still call super.execute("batman") it prints ">Robin" in subsequent > levels.) The second is that Child2 somehow calls execute on itself > once before digging into the next level of the tree, then at the last > level it tries to call it on an empty array which goes against the > program logic. I'm not new to programming, I've probably built this > exact same thing in Java, but I am new to Ruby. Whats wrong with what > I'm trying to do? In Ruby, you just call super() to call the parent method. There are three use cases for super: * Implicit args: `super` -- this calls the parent method with the same arguments as the current method call. * No args: `super()` -- the explicit empty parens mean call the parent method with no arguments, whatever the current method was called with. * Explicit args: `super(arg1, arg2 ...)` -- calls the parent method with the given arguments. Hope that helps. -- James Coglan http://jcoglan.com --001636c5bd8cf777e2046f250726--