From: Michael Weller Date: 2004-01-23T23:08:47+09:00 Subject: Re: [BEGINNER] Usage of 'super' Robert Klemme schrieb: >For me it doesn't work in the same file. It should always throw as Guy >pointed out already. I guess you might have tested something different >(maybe you forgot "< A" in one of the files). > > Here's my "real" code (BlogData.rb): class Timed attr_reader :time def initialize @time = Time.new # <-- line 23 end end class Entry < Timed attr_reader :title, :description def initialize(titleS, descS) super() @title = titleS @description = descS @comments = Array.new end def to_s "E : #{@title} -- #{@description} [#{@time}]" end end class Comment < Timed attr_reader :text def initialize(commentS) super() @text = commentS end end e = Entry.new('title1','desc1') puts e My shell: >ruby BlogData.rb E : title1 -- desc1 [Fri Jan 23 15:11:27 Westeurop�ische Normalzeit 2004] >Exit code: 0 And here's another file in the directory (t.rb): require 'BlogData' e = Entry.new('title1','desc1') puts e My Shell (with 'puts e' in BlogData.rb deleled): >ruby t.rb ./BlogData.rb:23:in `initialize': wrong number of arguments(0 for 2) (ArgumentError) from ./BlogData.rb:23:in `new' from ./BlogData.rb:23:in `initialize' from ./BlogData.rb:32:in `initialize' from t.rb:17:in `new' from t.rb:17 >Exit code: 1 It doesn't work if I "require" my code in another file. Writing "def initialize()" or "def initialize" doesn't make a difference, does it? Cheers! Michael