Squeak noob question - initialize

Steve Greenberg greenbes at gmail.com
Tue Jun 29 01:38:47 UTC 2004


Hi.  Long time programmer, new to smalltalk.

I'm trying to do the simplest thing, but there is clearly some basic
concept that I'm missing here.  I'm running Squeak 3.6.

In short, I have ClassA and ClassB, which is a subclass of Class A. 
Each class has one variable, and when I create the class I'd like to
see the initialization methods run on both classes.

When I execute:

    b _ ClassB new initialize

I expected that both classes would be initialized.  What actually
happens is that only ClassB is initialized.

Here is the source code.  Can anybody tell me what I'm doing wrong?

-------

Object subclass: #ClassA
	instanceVariableNames: 'anIntA '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'SEG'

initialize
	anIntA _ 1.

new
	^ super new initialize

-------

ClassA subclass: #ClassB
	instanceVariableNames: 'anIntB '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'SEG'

initialize
	anIntB _ 1

new
	^ super new initialize



More information about the Squeak-dev mailing list