Home News DOC Class DL Others Cooker
Documents  >  Tutorial  >  References
References

It accesses to an instance by an identifier.


Table of contents:


Identifier

Priority

Hiding

Address

Identifier

An identifier is a name introduced into the program. It corresponds to an instance by being declared or defined.


int i = 5;

int j = 5;

int k = i + j + 10;


The above i, j, k are identifiers. The correspondence with the value is determined in the definition statement. A memory area for each value is an instance.

Calls to a setter and getter may also be available in the same notation as references. Correspondence with an instance of a setter or getter is different from a reference by a simple identifier, but here we treate it as the same for convenience.


From the above, the following four can be accessed by an identifier.


Variable

Field

Setter

Getter

Priority

Instance search by identifier is performed in the following order. This is the reference priority.


Variable

Field

Setter and Getter


In addition, variables are searched in order from the inner scope to the outer scope.

Hiding

There may be instances associated with the same identifier. In this case, the instance with the highest priority is returned.


Identifier confliction hide low priority instances. There is no special notation for changing the priority, so you cannot access such an instance.

Address

If the reference returns an instance, the instance itself is not returned. The address of the memory where the instance was allocated is returned.

Next
Previous
Copyright © Rice All rights reserved.