Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Tutorial  >  references
References

Purpose of this chapter.

We will learn about the references which is the elements that make up the expression.

Access to instance by identifier.

A reference as an expression is an access to an instance by name(identifier).

As an example, let us show Moving getter of Circle class.


open getter bool Moving

if(_tt.Fitted)

return _tt.IsEnabled;

else

return false;

endif

endgetter


In the above code, _tt is a reference. It is accessing to the field with the identifier '_tt'.

Getter calls can also be used in the same notation as reference. The above Moving getter can be accessed just by the identifier 'Moving' if it is within the definition of the Circle class.


The following four are accessible by reference.


Variable.

Field.

Getter.

Setter.

Priority.

The reference searches an instance in the following order.


Variable.

Field.

Getter and Setter.


In addition, a variable will be searched in the order from the inner scope to the outer scope.

Hiding.

If an instance with the same identifier exists, the reference returns an instance with a higher priority. Instances with a lower priority are hidden in this case.

There is no special notation for changing the priority difference.

Address.

If the reference returns an instance, the instance itself is not returned. The address of the memory which the instance is allocated is returned.

Next
Previous
Copyright © Rice All rights reserved.