Field declaration
Field declaration
Fields are variables to hold the state of individual instance. In class definition, they are possible to declare any number at any place if outside of other member definitions.
Format is:
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 fitters.
access control of field
The field exists for the implementation and is not included in the public interface. Namely, cannot directly accesses to the fields from outside of the class definition.
To make the public interface is responsibility of other member.
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 class. Such fields have to be initialized by the fitter at run time.
hiding of name
If a field name conflicts 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.