Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Reference  >  getter
getter definition

getter definition

A getter is a subroutine which is invoked with the reference expression format.

Getter definition is the following format.

access-control getter return-type getter-name



In the class definition, it is possible to define getters of any number at any place outside the other member definitions.

Getter's main aim is the provision of way of access to a field.

access control

Access-control determines the access level of the getter by specifying a keyword either open or closed.

If the access-control is open, you can invoke the getter from outside the class definition. If the access-control is closed, you can invoke the getter only inside the class definition.

getter keyword

getter keyword indicates that this definition is getter. It must be present between the access-control and return-type.

return type

The return-type is a specification of a type of instance which is returned by getter.

getter name

The getter-name is a identifier.


An argument is not exist in getter definition.

endgetter keyword

An endgetter is a keyword which indicates an end of a getter definition. It has to exist at the end of a definition.


A getter generates a scope.

Please refer to the manual about the scope.


A getter can return to invoker from anywhere by return statement. The return statement of the getter should return an instance of the type which is specified

Copyright © Rice All rights reserved.