Last updated at 4:09 pm UTC on 14 January 2006
- Object subclass: #BankAccount
- instanceVariableNames: 'balance '
- classVariableNames: ''
- poolDictionaries: ''
- category: 'My Stuff'
At this point, you've got the description of a class. It is a sub-class
of Object. Object is the grandfather of all objects in the system. The
thing before "subclass:" is the super class, and the thing after is the
new class I'm creating. It has a single instance variable called "balance".
It doesn't have any class variables or pool dictionaries,
so you don't have to worry about what those are for the moment.
Your new class is going to be in the category "My Stuff".
So when we've got all that right we can either select "accept" from
the menu on the right-button of a two-button mouse (Option-click on the
Mac), or type the shortcut for "accept",
which is Alt-s (Command-s on the Mac). And that means Save. Accept
and Save are different terminology for the same concept.
Now we have this new kind of object. It
doesn't actually do anything yet. One of the
ways I like to program in Squeak is to start with a new class. Start with
an empty definition and add to it.