previous up next     contents index
Next: An Example Up: Programming Constructs Previous: Utilities

Classes and Objects

 

    MzScheme's object system uses the class-object model: every object is an instance of some class. Object variables a declared within a class, but are not instantiated until an instance of the class is created, Classes and objects are both first-class Scheme values. However, a MzScheme class is not a MzScheme object. (There are no ``meta-classes''.)

A MzScheme class specifies

An object is a collection of instance variables that are instantiated according to a class description. There is no distinction between ``methods'' and ``instance variables''; a method is simply an instance variable with a procedural value.

    The most important feature of the object system is the ability to define a new class (a derived class ) in terms of existing classes (the superclasses ) using inheritance and overriding:





PLT