Member variable

From Wiki @ Karl Jones dot com
Revision as of 19:47, 23 August 2016 by Karl Jones (Talk | contribs) (Created page with "In object-oriented programming, a '''member variable''' (sometimes called a '''member field''') is a variable that is associated with a specific object, and accessible for...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In object-oriented programming, a member variable (sometimes called a member field) is a variable that is associated with a specific object, and accessible for all its methods (member functions).

Types in class-based language

In class-based languages, these are distinguished into two types:

  • If there is only one copy of the variable shared with all instances of the class, it is called a class variable or static member variable
  • If each instance of the class has its own copy of the variable, the variable is called an instance variable.

See also

External links