Encyclopedia > Class variable

  Article Content

Class variable

In computer science's object-oriented programming, class variables (static fields) contain information which is associated with all instances of a class. If all tanks have one cannon, then it is not necessary to specify, in an instance variable for each tank object, that each tank has only one cannon; rather, one can simply define a class variable which does this and thus all instances of the class will share the variable.

See also: class method, instance variable



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
North Haven, New York

... average household size is 2.20 and the average family size is 2.77. In the village the population is spread out with 17.4% under the age of 18, 3.5% from 18 to 24, 22.3% ...

 
 
 
This page was created in 57.7 ms