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.
Instance search by identifier is performed in the following order. This is the reference priority.
Setter and Getter
In addition, variables are searched in order from the inner scope to the outer scope.
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.
If the reference returns an instance, the instance itself is not returned. The address of the memory where the instance was allocated is returned.