Menu

Classes

Will Pittenger

General discussion and sample

Classes in ASIL all derive from Object. (Maybe moved into a namespace later.) You use the following syntax to declare one:

class MyClass
    extends MyBaseClass
    implements IIinterface
  public constructor
    ' Initialize the class with the default constructor

  public constructor var String strString
    ' This constructor takes a string
    self.strString = strString

  static constructor
    ' Initialize some static members

  public var String strString
  private static var Boolean hidden = false
  private const i% = 3

  ' If MyClass were declared with the abstract keyword, Test could be declared with the abstract keyword instead of virtual
  protected virtual boolean Test
    return false

  creator
    return 7 ' 7 additional words

The Object class

This is the what the declaration of the Object class will probably look like along with some related interfaces:

class abstract Object
  public constructor
    ' Some code

  public virtual function toString
      returns String
    return type.toString

  public static final TypeInstance type ' See [Reflection]

interface IComparable
    inherits IEquatable
  public enum InstanceCompareResult
    lessThan
    equal
    greaterThan

  public function compare var const Object compareThis
    returns InstanceCompareResult

interface ICloneable
  public function clone
    returns Object

interface IEquatable
  public function equals var const Object compareThis
    returns Boolean

Related

Wiki: Constructors, creators, destructors, and garbage collection
Wiki: Home
Wiki: When is it a procedure, command, function, property, property accessor, method, complex statement, or type cast?
Wiki: keywords-class
Wiki: keywords-extends
Wiki: keywords-implements