Hi Joe,

Excellent question.  Try this.  

Object new. 

Highlight it and do debug it.   Click "Into" to go into the #new method.

Notice the implementation of #new.  

You should be able to see there that #initialize is called automatically.
 
Also for extra points notice what class new is implemented on.  What method 
should you call to skip initialize?

All the best,

Ron Teitelbaum



> -----Original Message-----
> From: beginners-boun...@lists.squeakfoundation.org [mailto:beginners-
> boun...@lists.squeakfoundation.org] On Behalf Of Joseph Alotta
> Sent: Tuesday, May 10, 2016 2:07 PM
> To: beginners@lists.squeakfoundation.org
> Subject: [Newbies] new and initialize
> 
> Greetings,
> 
> I have an instance method called ‘initialize’ that defines instance variables.
> 
> I want it to run whenever a new instance is created.  How do I accomplish
> that?
> 
> I tried to add a class method ‘new’  that contained ^(super new) initialize.
> But it warned me about adding the message saying it would have serious
> effects.
> 
> So where do I put it?
> 
> Sincerely,
> 
> Joe.
> 
> 
> 
> _______________________________________________
> 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