6. Classes

Base classes are defined using the following syntax:

class Image {
    var string url;
    var int w;
    var int h;
    var string alt;
    var string extrahtml;
    var string title;
    var string longdesc;
    function output;

A subclass of any class can be created as follows:

class Button extends Image {
    var string linkurl;
    var int bordersize;

All members of Image are now valid in Button, with the addition of our two new members linkurl and bordersize. The function Button::output will override Image::output if it exists, otherwise Image::output will be used as a fallback.

See the variable and function reference for the syntax for accessing members of classes.