Newbie question - Constructors

Mark Greenaway mark at knobbits.org
Mon Aug 28 14:17:42 UTC 2000


I'm using Squeak to try to learn about Smalltalk. At the moment I'm trying to
create a Frog class with a collection Frogs stored at class level. I want to
somehow override Frog new so that when a Frog instance is created, the new
method defined in the Frog class creates the object instance and then adds this
instance to the Frogs collection.

I've tried

new
	^super new initialize

initialize
	self class Frogs add: self

but the new defined in the Frog class is never called. Can someone please tell
me what I'm missing? Is this even the right approach in Smalltalk?

Thanks,
Mark





More information about the Squeak-dev mailing list