From: Henning von Rosen Date: 2001-11-22T07:38:00+09:00 Subject: [ruby-talk:26084] Re: differing #args to super.initialize? ----- Original Message ----- From: "Bill Kelly" To: "ruby-talk ML" Sent: Wednesday, November 21, 2001 11:24 PM Subject: [ruby-talk:26080] differing #args to super.initialize? > Hi all, > > I'm probably profoundly missing the obvious here, but why does the > following: > > 00: class A > 01: def initialize(a) > 02: end > 03: end > 04: > 05: class B < A > 06: def initialize(a, b) > 07: super.initialize(a) should be just super(a) "Within the body of a method, a call to super acts just like a call to that original method, except that the search for a method body starts in the superclass " Progr Ruby > 08: end > 09: end > 10: > 11: x = B.new(1,2) > > > yield: > test.rb:7:in `initialize': wrong # of arguments(2 for 1) (ArgumentError) suppose that is just due to the interpreting process; the interpreter thinks that you calls the superclass method without specified params, so the first error found is the original number of params (2). HTH /H