Hello,<br><br>I am new to Smalltalk and Squeak in general. After having
started to read "Inside Smalltalk" and "Smalltalk by Example" 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 "ComplexClass".<br><br>It is defined like this:<br>Object subclass: #ComplexClass<br> instanceVariableNames: 'firstVar secondVar'<br> classVariableNames: ''
<br> poolDictionaries: ''<br> 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 "new" to create an instance?
<br>Take, for example, my method "initializer":<br><br>initializer<br> | aVariable |<br> aVariable := ComplexClass new.<br> aVariable firstVariable: 22.<br> aVariable secondVariable: 23.<br> ^aVariable
<br><br><br>In both books there are methods quite similar to my "initializer" method.<br>But if execute:<br><br>aComplex2 := ComplexClass initializer.<br><br>I get an error message, something like "Undefined Object does not understand #initializer".
<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>