Next: , Up: obj-scl   [Contents][Index]


10.30.2.1 Scope of a Class Definition

A simple class definition begins with a statement of the form

:- class ClassName = [SlotDef, ].

The class’s slots are described in the list of SlotDef terms. It is possible, though not often useful, to define a class with no slots, by specifying the empty list. In that case the ‘=’ and the list may be omitted.

The class’s methods are defined following the class/1 directive, by Prolog clauses. Most of this section is about defining and using methods.

The class definition ends with any of the following:

:- end_class ClassName.

or

:- end_class.

or the next class/1 directive or the end of the file. The ClassName argument to end_class/1 must match the class name in the corresponding class/1 directive. It is not possible to nest one class definition inside another.


Send feedback on this subject.