Hello
Dominic Fox
dominic.fox1 at ntlworld.com
Sat May 17 23:58:14 UTC 2003
> * Is the best way to make what in C++ or Java you'd call "constructors" to
> write class methods that create, initialize and then return an instance,
> e.g.
>
> newFooWithBar: initialBar
>
> | newFoo |
>
> newFoo := Foo new; setBar: initialBar.
> ^ newFoo
>
> or is there a more concise way?
OK, I've got this one already. ^ super new init. Had me puzzled for a while
(why would I want to return a new instance of the *superclass*?) until I
figured out what the superclass was the superclass *of*...
Dominic
More information about the Squeak-dev
mailing list
|