From: David King Landrith Date: 2003-01-01T13:50:25+09:00 Subject: Re: Probems extending Array --Apple-Mail-2-812393769 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Thanks! That fixed my problem. Incidentally, how do you get a reference to the superclass? On Tuesday, December 31, 2002, at 01:50 PM, Dave Thomas wrote: > On Tue, 2002-12-31 at 11:51, David Landrith wrote: >> I'm having two problems extending the array class. >> >> First, I am getting instances where super == nil. > > Super isn't a pointer to the parent class's implementation: it's a call > to the method you're in, but in the partent class. > > class A > def fred(name) > puts "hello #{name}" > end > end > > class B < A > def fred(name) > super("walter") > super # calls it with current params > end > end > > b = B.new > b.fred("dave") > > => hello walter > hello dave > > > Cheers > > > Dave > ------------------------------------------------------- David King Landrith (w) 617.227.4469x213 (h) 617.696.7133 One useless man is a disgrace, two are called a law firm, and three or more become a congress -- John Adams ------------------------------------------------------- public key available upon request ------------------------------------------------------- David King Landrith (w) 617.227.4469x213 (h) 617.696.7133 One useless man is a disgrace, two are called a law firm, and three or more become a congress -- John Adams ------------------------------------------------------- public key available upon request --Apple-Mail-2-812393769 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-disposition: inline content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (Darwin) iD8DBQE+EnOMRdirey0+rJARAvlaAJ45ohRLXqSjFG/UxxJRxlLz+/LVuQCdESED gz6+6o+U0gGcSp3flOCAnLU= =5rje -----END PGP SIGNATURE----- --Apple-Mail-2-812393769--