SUPPORT THE WORK

GetWiki

member variable

ARTICLE SUBJECTS
aesthetics  →
being  →
complexity  →
database  →
enterprise  →
ethics  →
fiction  →
history  →
internet  →
knowledge  →
language  →
licensing  →
linux  →
logic  →
method  →
news  →
perception  →
philosophy  →
policy  →
purpose  →
religion  →
science  →
sociology  →
software  →
truth  →
unix  →
wiki  →
ARTICLE TYPES
essay  →
feed  →
help  →
system  →
wiki  →
ARTICLE ORIGINS
critical  →
discussion  →
forked  →
imported  →
original  →
member variable
[ temporary import ]
please note:
- the content below is remote from Wikipedia
- it has been imported raw for GetWiki
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). 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; while if each instance of the class has its own copy of the variable, the variable is called an instance variable.WEB, 2011-08-12, Richard G. Baldwin, 1999-03-10,weblink Richard G Baldwin Programming Tutorials, Q - What is a member variable?, A member variable is a member of a class (class variable) or a member of an object instantiated from that class (instance variable). It must be declared within a class, but not within the body of a method of the class.,weblink

Examples

C++

class Foo {
int bar; // Member variable
public:
void setBar(const int newBar) {
bar = newBar;
}
};int main () {
Foo rect; // Local variable


return 0;
}

Java

public class Program{
public static void main(String[] args)
{
 // This is a local variable. Its lifespan
 // is determined by lexical scope.
 Foo foo;
}
}public class Foo{
// This is a member variable - a new instance
// of this variable will be created for each
// new instance of Foo. The lifespan of this
// variable is equal to the lifespan of "this"
// instance of Foo
int bar;
}

Python

class Foo:
@property
def bar(self):
return self._bar


@bar.setter
def bar(self, new_bar):
self._bar = new_bar
f = Foo()f.bar = 100print(f.bar)

See also

References

{{Reflist|2}}{{Compu-prog-stub}}

- content above as imported from Wikipedia
- "member variable" does not exist on GetWiki (yet)
- time: 9:40am EST - Mon, Dec 17 2018
[ this remote article is provided by Wikipedia ]
LATEST EDITS [ see all ]
GETWIKI 09 MAY 2016
GETWIKI 18 OCT 2015
M.R.M. Parrott
Biographies
GETWIKI 20 AUG 2014
GETWIKI 19 AUG 2014
GETWIKI 18 AUG 2014
Wikinfo
Culture
CONNECT