The early chapters of this tutorial discussed classes in one of two ways. The “toy” classes we developed were rooted at Object; the system-provided classes were treated as immutable entities. While one shouldn’t modify the behavior of the standard classes lightly, “plugging in” your own classes in the right place among their system-provided brethren can provide you powerful new classes with very little effort.
This chapter will create two complete classes which enhance the existing Smalltalk hierarchy. The discussion will start with the issue of where to connect our new classes, and then continue onto implementation. Like most programming efforts, the result will leave many possibilities for improvements. The framework, however, should begin to give you an intuition of how to develop your own Smalltalk classes.
|• The existing hierarchy:||We’ve been talking about it for a while, so here it is at last|
|• Playing with Arrays:||Again.|
|• New kinds of Numbers:||Sounds interesting, doesn’t it?|
|• Inheritance and Polymorphism:||Sounds daunting, doesn’t it?|