Difference between revisions of "Instance variable"

From Conservapedia
Jump to navigation Jump to search
m (cat-ching up almost done)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
An '''instance variable''' is available only to one instance of a class. It is the object's own property. For example, a particular square may be 4 inches wide. Other squares may have different widths.  
+
An '''instance variable''' is a [[variable]] which available only to one instance of a class. It is the object's own property. For example, a particular square may be 4 inches wide. Other squares may have different widths.  
  
A [[class variable]], by contrast, is available to all instances of a class. It is a property which is the same for all objects. For example, the interior angle of every square is 90 degrees, no matter how wide the square is.
+
A class variable, by contrast, is available to all instances of a class. It is a property which is the same for all objects. For example, the interior angle of every square is 90 degrees, no matter how wide the square is.
[[Category:Mathematics]]
+
 
 +
[[Category:Computer Programming]]

Latest revision as of 02:20, February 22, 2009

An instance variable is a variable which available only to one instance of a class. It is the object's own property. For example, a particular square may be 4 inches wide. Other squares may have different widths.

A class variable, by contrast, is available to all instances of a class. It is a property which is the same for all objects. For example, the interior angle of every square is 90 degrees, no matter how wide the square is.