Jump to content

Talk:Class variable

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jay (talk | contribs) at 07:16, 18 June 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputing Stub‑class
WikiProject iconThis 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.
StubThis article has been rated as Stub-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.
WikiProject iconC/C++ Stub‑class
WikiProject iconThis article is within the scope of WikiProject C/C++, a collaborative effort to improve the coverage of C and C++ topics 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.
StubThis article has been rated as Stub-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the importance scale.

Shared across instances

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) [reply]

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)[reply]

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)[reply]

2003 edits

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

"Static field" listed at Redirects for discussion

A discussion is taking place to address the redirect Static field. The discussion will occur at Wikipedia:Redirects for discussion/Log/2021 June 18#Static field until a consensus is reached, and readers of this page are welcome to contribute to the discussion. - Jay (Talk) 07:16, 18 June 2021 (UTC)[reply]