|
|
|
|
|
by oopd
5970 days ago
|
|
In Smalltalk, when you type the name of a class you are really referencing a global variable that refers to a class object. "Dictionary new" means send the message #new to Dictionary, and the Dictionary class object will respond by giving you a new instance of itself. "Dictionary compile: 'foo ^ 42' classified: #accessing" will add a method "foo" to Dictionary under the "accessing" category that will return 42 (an instance of SmallInteger). Classes in Smalltalk are living objects available for manipulation at all times. They have their own instance variables/methods, just like any other object. Java, C++ and C# treat the class as some sort of namespace into which you can place global functions/variables. |
|