Class
Class syntax

You can declare a class in Yuma with this syntax:


Class <Name>
[Implements <interfaceName>]
[Inherits <superclassName>]
[Methods]
[Properties]
End Class


The syntax shown above declares a new class of the given name. Sections in square brackets are optional.

If the "Inherits" line is included, then the new class is a subclass of the indicated superclass, and inherits the methods and properties thereof.

If an "Implements" line is included, then your class is declared to implement the given interface. You must then be sure to include every method defined by that interface. You may have as many "Implements" lines as you wish. (As an example from the Yuma framework, the BinaryStream class implements three interfaces, Readable, Writeable, and Closeable.)

Methods and properties may appear in any order, and may include both Shared and regular items. For more information on scope and shared items, see Methods.

Special Class Methods
In general, you can name your methods whatever you want, within standard identifier limitations (i.e. start with a letter, and include only letters, numbers, and underscores). But there are some method names that have special meaning to the compiler. These include:

Constructor: a subroutine named "Constructor" is automatically invoked whenever a class instance is created with New. You may have multiple constructors, each with a different parameter list; the compiler will select one based on the arguments passed to New. You don't have to have any constructors; if you don't, then an empty, no-parameter constructor is assumed. But if you do have a constructor which matches the New call, then normal access rules apply; if the caller would not have access to that constructor, then the New call will not compile.

Destructor: a subroutine named "Destructor", with no parameters, is automatically invoked when an instance of that class is destroyed.

The Super Keyword
Code in a subclass can invoke a protected or public superclass method using the "Super." prefix. This is especially handy when you have overridden the superclass method, but wish to invoke that method and then do some additional processing in the subclass.