Hello,<br><br>I am new to Smalltalk and Squeak in general. After having
started to read &quot;Inside Smalltalk&quot; and &quot;Smalltalk by Example&quot; i came
along two similar examples, which sound quite reasonable but don't seem
to work in Squeak.
<br>I want to create an instance of my own class &quot;ComplexClass&quot;.<br><br>It is defined like this:<br>Object subclass: #ComplexClass<br>&nbsp;&nbsp;&nbsp; instanceVariableNames: 'firstVar secondVar'<br>&nbsp;&nbsp;&nbsp; classVariableNames: ''
<br>&nbsp;&nbsp;&nbsp; poolDictionaries: ''<br>&nbsp;&nbsp;&nbsp; category: 'TestClass'<br><br><br>I can create instances with <br>aComplex := ComplexClass new.<br>normally.<br><br>But what if i wanted to call another method instead of &quot;new&quot; to create an instance?
<br>Take, for example, my method &quot;initializer&quot;:<br><br>initializer<br>&nbsp;&nbsp;&nbsp; | aVariable |<br>&nbsp;&nbsp;&nbsp; aVariable := ComplexClass new.<br>&nbsp;&nbsp;&nbsp; aVariable firstVariable: 22.<br>&nbsp;&nbsp;&nbsp; aVariable secondVariable: 23.<br>&nbsp;&nbsp;&nbsp; ^aVariable
<br><br><br>In both books there are methods quite similar to my &quot;initializer&quot; method.<br>But if execute:<br><br>aComplex2 := ComplexClass initializer.<br><br>I get an error message, something like &quot;Undefined Object does not understand #initializer&quot;.
<br>Do i have to write:<br><br>aComplex2 := ComplexClass new.<br>aComplex2 := aComplex2 initalizer.<br><br>That would work but it is quite ugly.<br>