Class variable

In class-based, object-oriented programming, a class variable is a variable defined in a class of which a single copy exists, regardless of how many instances of the class exist.[1][2][3][4][5]

A class variable is not an instance variable. It is a special type of class attribute (or class property, field, or data member). The same dichotomy between instance and class members applies to methods ("member functions") as well; a class may have both instance methods and class methods.

  1. ^ "The Java Tutorial, Variables". Retrieved 2010-10-21.
  2. ^ "The Java Tutorial, Understanding Instance and Class Members". Retrieved 2010-10-21.
  3. ^ "The Python Language Reference, Compound Statements". Retrieved 2010-10-21.
  4. ^ "Objective-C Runtime Reference". Apple Developer. Retrieved 1 April 2018.
  5. ^ "Class Variables in C#". Syntaxdb. Retrieved 1 April 2018.

Developed by StudentB