Home News DOC Class DL Others Cooker
Documents  >  Reference  >  Setter definition
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)



It can use the abbreviation es instead of 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

Identifier and embedded class name can use for the setter name.


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


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.

It can use the abbreviation es instead of endsetter.


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


A setter generates a scope.

Please refer to the manual about the scope.


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.

Copyright © Rice All rights reserved.