![]() |
member > instance member > instance variable |
![]() ![]() | ||||
instance variable (data member, field, object variable) | ||||
subject | fact |
instance variable | is a synonym of data member | ![]() |
is a synonym of field | ![]() | |
can be inherited | ![]() | |
can be accessed by all methods of its class | ![]() | |
can be made private to prevent direct access to instance variable - accessor methods should be used instead to protect data abstraction | ![]() | |
has definition A data item present in all the instances of a class, normally used to implement associations and attributes | ![]() | |
has definition Any item of data that is associated with a particular object. | ![]() | |
implements an attribute or an association ![]() | ![]() | |
is part of an object | ![]() | |
is a subtopic of Members | ![]() | |
is defined by an instance variable definition | ![]() | |
is a kind of instance member | ![]() | |
is a kind of member variable | ![]() | |
maintains part of its object's state | ![]() | |
refers to an object or a primitive | ![]() | |
should be as private as reasonably possible - almost never make an instance variable public ![]() | ![]() | |
should be placed in a class such that there is no needless duplication of it, and such that it is useful in all the subclasses of the class in which it is defined | ![]() | |
to refer you join the name of the variable with a dot to the instance variable name. Example: variableName.instanceVariableName | ![]() | |
is a synonym of object variable | ![]() | |
member variable | can be declared anywhere in a class outside of a method | ![]() |
can be initialized by an assignment statement | ![]() | |
is a member of a class or an object | ![]() | |
is accessible to the code in its class | ![]() | |
variable | can contain different classes of objects depending on the type of the variable | ![]() |
can contain only values that are of the same type as the variable or a subtype of the variable's type | ![]() | |
can have an interface as its type which means that, with the variable, you can invoke any operation supported by the interface ![]() | ![]() | |
has 1 value at any one time which is the that it refers to | ![]() | |
has 1 name | ![]() | |
has scope which is the block in which it is declared | ![]() | |
has type ![]() | ![]() | |
has lifetime which is the time its block is being executed | ![]() | |
has purpose to refer to an object or a class or a primitive datum | ![]() | |
has scope | ![]() | |
has part value | ![]() | |
is declared by giving the data type followed by the name of the variable ![]() | ![]() | |
is destroyed in the block where it is declared | ![]() | |
may have access modifier | ![]() | |
should have comment if it is non-obvious | ![]() | |
access unit | has access mode | ![]() |
syntactic unit | has syntax rule bold = mandatory | ![]() |
Next instance member: instance method Up: instance member, member variable