I would really like to see some mention of the negative of properties. In particular, the statement "properties provide a higher level of encapsulation than pu
| This article has not yet been rated on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
| |||||||||||
I would really like to see some mention of the negative of properties. In particular, the statement "properties provide a higher level of encapsulation than public fields" is really a stretch. Properties basically override encapsulation in the worst possible way. See, for example, http://elegantcode.com/2008/09/26/properties-a-false-sense-of-encapsulation/ — Preceding unsigned comment added by 99.226.116.206 (talk) 01:46, 12 July 2013 (UTC)
I'm reluctant to make a really radical change - yet I can't really see the point to the "See also" section when there are links in the first pp. - Jon Shemitz 10:33, 11 September 2006 (UTC)
The python example doesn't cause an exception as claimed: >>> pen.readonly = "Something Else" # this fails (raises an exception) >>> pen.readonly 'Something Else' >>>
Also it would be nice to be able to copy and paste the python directly into a python shell. Currently there are indentation errors if a direct copy-paste is done.
Thanks.
The article states
"Some object-oriented languages, such as C++ and Java, don't support properties, and require the programmer to define a pair of accessor and mutator methods instead."
I won't speak to C++, but Java has had a persistent properties API available since it's release.
java.util.Properties has been available since 1.0.
What about Scala? Does it support properties (get/set, not this lib)? —Preceding unsigned comment added by 200.100.199.203 (talk) 04:08, 14 July 2010 (UTC)
Does anyone know who came up with the idea or what programming language first implemented them? Delphi was the first one I used that had them. I can't say that there wasn't something before that, however. --71.214.223.133 (talk) 19:50, 17 January 2010 (UTC)
The example given for C++ is short, but the code provided doesn't really offer support for getter and setter methods much less any additional stuff properties are good for.
Anyway, what I'm trying to say is that the sample provided doesn't really provide property functionality, it just strict-types the member. The above links provide much better functionality.
I also think these links should be mentioned in the C++ text with references to these pages so that the reader can be directed to proper solutions right away. The only reason I haven't done that myself is because I have "a personal interest" with my own implementation here.
Please discuss.
Velis74 (talk) 07:04, 20 March 2012 (UTC)
Tried to copy/paste an example from Stack Overflow (Portability of Native C++ properties) but edit was blocked, so I just put a link instead. Can someone with higher privileges copy the code from https://stackoverflow.com/a/5924281 ? Ta. — Preceding unsigned comment added by 42.190.201.161 (talk) 22:03, 5 January 2022 (UTC)
The definition is very poor and doesn't help. First sentence: Defines property as been in between field and method, which are terms not necessarily known to the reader. Simply more confusing than clarifying... One comes with the question "what is a class property?", and the first thing you get is "go and get to understand these two other things (fields and methods)"... Second sentence: Again sets the qualification of Property as a function of Fields... And the definition continues along the same lines... 0_o
This is, for a non-expert, like going to check the definition for "Lake", and the definition starting "A lake is a body of water in between a sea and a swimming pool. Lakes are like sea in so that they have water, but lakes are usually not salty"
I'm sorry, but this is really my impression. I cannot help to define it better since I don't know what a Property is. — Preceding unsigned comment added by 87.144.106.246 (talk) 08:08, 14 October 2016 (UTC)
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.