Data types: class

Represents any arbitrary Chora class.

Type syntax

class

Literal syntax

unit‑name::class‑name

null

Discussion

Operands of this data type are intended to store references to individual Chora classes.

The class literal corresponds to the full name of the respective class, or it is null to explicitly identify 'no class'. The literal can be used within expressions wherever a class operand is expected. The type name class, in turn, is designated to be used in declarations of data members. For example:

var class theClass = null; // 'theClass' doesn't refer to any Chora class. theClass = Views::Text; // now 'theClass' refers to the Views::Text class

Instantiating objects

Operands of the class data type are usually used in conjunction with the new operator to create new instances of the class represented by the operand.

Evaluating class' ancestry

You can evaluate the ancestry of the class stored in a class operand. With the classof operator, you can obtain a new class operand representing the class of an object.

Comparison operations

You can compare two class operands in order to test whether these refer to the same class or not. The following table provides an overview of the possible operations:

Operator

Short description

==

Equality test for two class operands.

!=

Inequality test for two class operands.