1 Evaluation Model
2 Syntax Model
3 Core Syntactic Forms
4 Core Datatypes
5 Structures
6 Classes and Objects
7 Units
8 Contracts
9 Control Flow
10 Concurrency
11 Macros
12 Input and Output
13 Reflection and Security
14 Operating System
15 Memory Management
16 Running PLT Scheme
Index

contents

 index

← prev  up  next →

 

6 Classes and Objects

    6.1 Creating Interfaces

    6.2 Creating Classes

      6.2.1 Initialization Variables

      6.2.2 Fields

      6.2.3 Methods

        6.2.3.1 Method Definitions

        6.2.3.2 Inherited and Superclass Methods

        6.2.3.3 Internal and External Names

    6.3 Creating Objects

    6.4 Field and Method Access

      6.4.1 Methods

      6.4.2 Fields

      6.4.3 Generics

    6.5 Mixins

    6.6 Object Serialization

    6.7 Object, Class, and Interface Utilities

A class specifies

An object is a collection of bindings for fields that are instantiated according to a class description.

The object system allows a program to define a new class (a derived class) in terms of an existing class (the superclass) using inheritance, overriding, and augmenting:

An interface is a collection of method names to be implemented by a class, combined with a derivation requirement. A class implements an interface when it

A class can implement any number of interfaces. A derived class automatically implements any interface that its superclass implements. Each class also implements an implicitly-defined interface that is associated with the class. The implicitly-defined interface contains all of the class’s public method names, and it requires that all other implementations of the interface are derived from the class.

A new interface can extend one or more interfaces with additional method names; each class that implements the extended interface also implements the original interfaces. The derivation requirements of the original interface must be consistent, and the extended interface inherits the most specific derivation requirement from the original interfaces.

Classes, objects, and interfaces are all values. However, a class or interface is not an object (i.e., there are no “meta-classes” or “meta-interfaces”).

 

contents

 index

← prev  up  next →