Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Member variable
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Variable associated with a specific object, and accessible for all its methods}} In [[object-oriented programming]], a '''member variable''' (sometimes called a '''member [[Field (computer science)|field]]''') is a [[variable (programming)|variable]] that is associated with a specific [[Object (computer science)|object]], and accessible for all its [[method (computer science)|methods]] (''member functions''). In [[class-based programming]] languages, these are distinguished into two types: ''[[class variable]]s'' (also called ''static member variables''), where only one copy of the variable is shared with all [[instance (computer science)|instance]]s of the [[Class (computer programming)|class]]; and ''[[instance variable]]s'', where each instance of the class has its own independent copy of the variable.<ref>{{cite web | accessdate = 2011-08-12 | author = Richard G. Baldwin | date = 1999-03-10 | publisher = Richard G Baldwin Programming Tutorials | title = Q - What is a member variable? | quote = 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. | url = http://www.dickbaldwin.com/java/Java020.htm}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)