Cind language documentation

Objects and null value

Type object

An object type is a default type of an object and also a type from which every object in the Cind language inherits
(for more about inheritance see Class inheritance).

Defining variable:

object x;

is equivalent to defining variable without type:

var x;

And to define a variable of an array type of any object as an element, write:

object[] x;

For more about types of variables and arrays see Variables, Arrays and Creating objects.

Object of class object accepts only one message isException returning false value. Which means, that every object will also accept this message.

Object null

Value null represents missed value.
For instance, every variable before first assignation will have null value, and also fields of new created array will have null values (see Variables).

In the Cind language null is also an object. For example:

x = null;

assigns null object to the variable x, which means, for example, that the previous value will be forgotten.

Object null accepts no messages and only two operators: == and !=, which check, if the second argument is also a null object.

Object null can be converted to the following types (see Type conversion):

dest type returned value
bool false
byte 0x00
int 0
float 0.0
char '\0'

Converting the null object to any other type will keep null object as a value.



Cind programming language 1.0.4

 

Advertisements