Hi
I am trying to get started with gnu-smalltalk, and i have a couple trivial questions. I can't find a sample st script that uses the [ ] delimiters rather than the fileOut ! version.

The following code works. But if i move the definition of new into the definition Account init is not called. Don't know why.
Also i do a snapshot at the end, is that the right approach?

The code>>
Object subclass: Account [
   | balance |
   hi [
       'hi i am ok' printNl
   ]
]
Account class extend [
   new [
       | r |
       <category: 'instance creation'>
       r := super new.
       r init.
       ^r
   ]
]
Account extend [
   init [
       <category: 'initialization'>
       balance := 0.
       'is initialized' printNl
   ]
   setBalance: newBalance [
       balance := newBalance
   ]
   getBalance [
       ^balance
   ]
]
ObjectMemory snapshot: 'account.im'




_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to