Make your own object initialization
Jump to navigation
Jump to search
- STARTED
- How do you make a new object instance ? Usually you call
new
. - If you don't define
new
yourself and no other superclasses will, new will be found in the Behavior class where there is alsobasicNew
, let's see it
Behavior >> new "Answer a new initialized instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable." ^ self basicNew initialize
- So, ignoring indexable variables (vectors and the likes)
new
callsbasicNew
and the callsinitialize
basicNew
calls primitive <70>, so that is the end of the story, the ball now it to the VM.- After that the balls passes to
initialize
, here again, if you defined it yoursef ...