Class Modifiers
Divider

The Class statement can have the following modifiers preceding the Class keyword:

The following restrictions are placed on the use of these modifiers:

Final

Final specifies that the class cannot act as a base class.  All functions in a Final class are implicitly Final as well.  The Final keyword should be used when you want to ensure that the implementation for the class is not changed.

Certain optimizations are possible for a Final class. In particular:

Stripped

A stripped class is a class that does not have a pointer to run-time type information.  The Stripped keyword is provided purely to save memory and the small overhead of setting the RTTI pointer for new instances of the class.

Whether to apply the Stripped modifier to a class is a judgment call, but in general you should only use the Stripped modifier if:

The built-in numerical types, Boolean, and String are all Stripped.

A Stripped class A with an instance a or reference thereto has the following properties:

When it says members of a stripped class are Final, that includes the destructor.  Thus, you generally cannot have a destructor in a class derived from a Stripped class--a very serious limitation indeed!  There is one exception, and that is if the Stripped class is also Abstract and no destructor is provided.

Exported

The Exported keyword currently has no meaning.

It is intended for use in QDL platforms that support closed world analysis.  It would mean that the class is shared with external programs and therefore must not have certain closed-world optimizations applied to it.

Abstract

An abstract class is a class that contains Abstract Functions. You must declare a class as Abstract to have Abstract functions, or to declare a class that inherits from a class that has Abstract functions, but which does not redeclare and define all of those functions. An Abstract function is a non-Final function that does not have a function body and therefore cannot be called. An Abstract class cannot be instantiated.

Like the Override keyword, the Abstract keyword is redundant (well, usually): the compiler knows whether there are abstract functions in the class; the Abstract keyword forces the programmer to acknowledge it.  However, the Abstract keyword can be applied even if there are no Abstract functions.  This should be done when the class should not be instantiated directly.

In an abstract class, a default constructor and destructor is not automatically created.  You must explicitly create both.  If no destructor is provided, then you cannot call Delete with a reference to the abstract class, since there is no destructor to call.

Published

The Published keyword indicates to the compiler that you want the contents of the class published at run-time.  In an indirect way, the members of all superclasses are also published, even if they do not have the Published keyword.

The contents of the class can be accessed at run-time using the PublishedData member of the Class instance associated with the class.  All members of the class are published, even private members.

Table of Contents Qwertie's Site/Mirror
Next
Previous
Hosted by www.Geocities.ws

1