Home News DOC Class DL Others Cooker
Documents  >  Reference  >  Field declaration
Field declaration
Field declaration

Field is the variable to hold the state of individual instance. In class definition, if outside of the fitter, setter, getter, and method definition, it is possible to declare any number at any place.

Field declaration is the following format.

class-name identifier ;

Please note that a field cannot define. Responsibility of field declaration is to reserve a space. Initialization of an instance is responsibility of a fitter.

access control of field

The field exists for the implementation of the class and is not included in the public interface of the class. Namely, outside of the class definition, the function that accesses to the fields by the field name does not exist.

To make the public interface of the class is responsibility of the setter, getter, and method.

declaration of undefined class

It is possible to use undefined class name in the field declaration. If an undefined class has been declared, the Rice temporarily secures the instance of the dummy type. Such fields have to be initialized by the fitter at run time.

Please refer to a manual about details of dummy type.

hiding of name

If a field name conflict with setter or getter, the field is given priority and hides the setter and getter. When the name conflicted, there is no way to access a hidden member.

Copyright © Rice All rights reserved.