This loads the package.
The main entry point to this package is the function
Class, which defines all classes. A class is (re)defined by assigning a set of definitions to the class. Usually, a delayed assignment (
:=) is used for methods instead of a direct one (
=) in order to prevent the evaluation of the definitions during the definition of the class itself. Using a direct assignment does not harm, if the symbols used in the member definitions have no definitions associated to them. The next example defines a class with one field and one method that is directly derived from
Object, which is the base of all classes. The output is specially formatted and shows that a default constructor "
base" was added automatically to the class, because there is no user-defined constructor. The last members take care of a symbol not found within the class and are printed in an abbreviated form.
All class members only have a meaning in the context of an object created by the class. Directly using the method has no effect, because there is no definition made for meth itself.
Field values can be directly assigned.
A child class can be easily derived. The next class overrides a method of the parent, which is emphasized by means of the
Override qualifier. Class members not found are now searched for in "
base".