Also known as: member variable
A variable that is associated with an object rather than the class of object. An instance variable is only accessible from within or via an instance of the class and is typically used to access information that is expected to be different from one instance to another.
private int uniqueFlightNumber = 2000; Example InstanceVariable embedded from java/com/clrstream/ex6/services/test/SetupStyles.java
The exact syntax used to access an instance variable varies from language to language. The most common syntax is objectReference.variableName (when the instance variable is not considered private). When referenced from within methods on the object, some languages require an explicit reference to the object (e.g. self myVariableName or this.myVariableName) while others just assume that any variables are instance variable unless overridden by local variables.
Copyright © 2003-2008 Gerard Meszaros all rights reserved