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

A setter is a subroutine which is invoked with the assignment statement format.

Setter definition is the following format.


access-control setter setter-name(argument)

statements

endsetter


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

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

access control

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

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

setter keyword

setter keyword indicates that this definition is setter. It must be present between the access-control and setter-name.

setter name

The setter-name is a identifier.

argument

The argument is a single pair of the class name and identifier which is surrounded by parentheses.

statemants

The statements is optional. Namely, the setter without a statement is permitted. However, it is meaningless.

endsetter keyword

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

overload

You can define any number setter which has same name if type of argument is different.

scope

A setter generates a scope.

Please refer to the manual about the scope.

return

A setter can return to invoker from anywhere by return statement. The return statement of the setter should not return an instance. If the control has reached the endsetter without encountering a return statement, it assume that there was a return statement and return to caller.

Next
Previous
Copyright © Rice All rights reserved.