[previous] [up] [next]     [contents] [index]
Next: Object Example Up: PLT MzScheme: Language Manual Previous: Structure Utilities

Classes and Objects

A MzScheme class specifies

An object is a collection of bindings for 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 core feature of the object system is the ability to define a new class (a derived class) in terms of an existing class (the superclass) using inheritance and overriding:

An interface is a collection of variable names that could be declared by a class. A class implements an interface when it

A single class can implement any number of interfaces. A derived class automatically implements any interface that its superclass implements.

A new interface can extend one or more interfaces with additional variables; classes that implement the extended interface also implement the original interfaces.

Classes, objects, and interfaces are all first-class Scheme values. However, a MzScheme class or interface is not a MzScheme object (i.e., there are no ``meta-classes'' or ``meta-interfaces'').





PLT