Guess how you create a new class? This should be getting
monotonous by now--by sending a message to an object.
The way we create our first "custom" class is by sending the
following message:
Quite a mouthful, isn't it? Most people end up customizing
their editor to pop this up at a push of a button. But
conceptually, it isn't really that bad. The Smalltalk variable
Object is bound to the grand-daddy of all classes on the
system. What we're doing here is telling the Object class
that we want to add to it a subclass known as Account.
The other parts of the message can be ignored, but
instanceVariableNames: 'balance' tells it that each object
in this subclass will have a hidden variable named
balance. (23)
Please take a moment to fill out
this visitor survey You can help support this site by
visiting the advertisers that sponsor it! (only once each, though)