From: James Britt Date: 2005-05-16T22:29:49+09:00 Subject: Re: Newbie: pinpoint my mistake please.. dobest03 wrote: > Hello. > > Can anyone pinoint me where I made a mistake? > > Error message is as follows: ... > But if I commented out "ths doesn't works" and remove comments > on "this works" codes, it works. Don't the code > > @checking = super(checking) > @savings = super(savings) > > create a new 'Account' class instances and stores them into > instance variable of class 'Accounts' @checking and @savings > respectively? Calling 'super' invokes the method of the same name in the parent class. So, calling 'super' here invoke the method 'initialize' in Account. But 'initialize' does not return a new instance of the class; the method 'new' does. (Calling 'new' makes a call to 'allocate', then calls 'initialize' on the object just allocated, and then returns the new object. ) You may be better off removing the inheritance and simply using @checking = Account.new( checking ) @savings = Account.new( savings ) James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com