Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Reference  >  accesscontrol
access control

access modifiers

The open and closed keyword are access modifiers. Access modifiers determine the access level of a member.

If you specify the open keyword at the beginning of the member definition, the member is open member. You can invoke the open member at anywhere in the program.

If you specify the closed keyword at the beginning of the member definition, the member is closed member. You can invoke the closed member only at the class definition which the member has been defined.

default access level

A field is always closed. Therefore, an access modifier is unnecessary.

Other members do not have default access level. Therefore, you have to specify an access modifier at the beginning of the fitter, setter, getter, and method definition.

A class is always open. Therefore, an access modifier is unnecessary.

encapsulation of the class level

Access control of the Rice is carried out at the class level. Namely, the definition of the class A can access the closed members of all instances of class A.

For example,


class sample

int _fi;

...

open setter Fi(sample val)

_fi = new int(val._fi); //♦1

endsetter

...

endclass


♦1 : The definition of the class sample is possible to access to the closed members of the val because the val is the sample class.

Next
Previous
Copyright © Rice All rights reserved.