Talk:Class variable

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing  
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
 
WikiProject C/C++  
WikiProject icon This article is within the scope of WikiProject C/C++, a collaborative effort to improve the coverage of C/C++ on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the quality scale.
 ???  This article has not yet received a rating on the importance scale.
 

Shared across instances[edit]

not sure where i'm supposed to put this, top or bottom, but this is an incorrect definition. in many oop languages, including c# and java, a class member variable or (class variable) for short is instance agnostic. e.g. it can either be a static or an instance variable. can someone fix this? -bc —Preceding unsigned comment added by 64.125.183.186 (talk) 18:53, 25 June 2010 (UTC)

fuck it. i fixed it. vera, your definition here is incorrect. - bc —Preceding unsigned comment added by 76.95.140.83 (talk) 20:50, 3 July 2010 (UTC)
Actually, class variable values are by definition shared by all instances of a class, and instance variables can never be class variables. See [1] for an explanation of this for Java and [2] for a Python one. Even Objective C, which does not have a dedicated class variable syntax, recognizes the concept of class variables as distinct from instance variables in its runtime reference at [3]. I will edit the article to remove any confusion about this and add citations. Links to references for other object-oriented languages' use of the "class variable" term would be very welcome, particularly links to C# and C++ references. -cph --173.226.146.65 (talk) 18:49, 21 October 2010 (UTC)

2003 edits[edit]

Vera Cruz, please hold your horses on these multiple edits within a short time span. This is neither the correct name for this article nor the correct definition.

The correct name is class data member and in the the definition it should be made clear that when you say all instances share the member that we are not talking about static members, and indicate that static members have one instance across all instances of the class. Mintguy — Preceding undated comment added 16:20, 16 January 2003

I see what you're doing now. But I think class variable is the Java name for the term, static data member is the C++ name for the term. I'm not sure what the correct OOP name is. Mintguy — Preceding undated comment added 16:26, 16 January 2003
Im going to go play chess now. You should use my talk page as Im likely to miss talk on wiki pages. You should also request that wikipedia install a bbs and chatrooms Vera Cruz — Preceding undated comment added 16:29, 16 January 2003