Any class method can be a constructor.  

At the end of the day (bottom of the stack) most new instances are created with 
basicNew.  This is a low level call that just allocates the object's memory and 
associates it with the class (and sets all ivars to nil).  The default ctor in 
user space is new, which calls basicNew and then initialize on the object.

Suppose you have a Socket class and want a constructor that takes an ip 
address.  You'd just create a class side method

openOnIpAddress: anAddress
   ^self new openOn: anAddress.

or something like that (this is totally off the top of my head - any 
resemblance to actual Squeak code is purely coincidental). 

-Todd Blanchard

On Thursday, May 11, 2006, at 10:05AM, Rich <[EMAIL PROTECTED]> wrote:

>I watched Stephane's Squeak videos (they helped alot btw) and was left
>wondering how one goes about making multiple constructors for a class.
> Is it even possible?  Thank you.
>
>-Rich
>_______________________________________________
>Beginners mailing list
>Beginners@lists.squeakfoundation.org
>http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to