
Sorry, Edward Diener is absolutely correct in this manner. The C# language is very clear about what properties are, why they're part of the language, and how they're used. Let me remind you that this topic is: "interest in C# like properties for C++?" x.count() is not a property usage... it is a blatant accessor function call Think about these two lines of code: int x, y; x = y = 100; Now, if x and y were properties instead of variables, you would be able to write code like this: obj.x = obj.y = 100; Now, how would you write that line of code using accessor functions? By any standard, it would be inferior to the syntax above. -Sid Sacek -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Stefan Strasser Sent: Wednesday, October 21, 2009 1:06 AM To: boost@lists.boost.org Subject: Re: [boost] [property] interest in C# like properties for C++?
[Stefan Strasser [strasser@uni-bremen.de] wrote:]
x.count(5); int I = x.count();
[ Edward Diener [eldiener@tropicsoft.com] wrote: ]
I do not believe this is the right syntax for accessing properties. The idea of a "property" is that one uses syntax to access it as if it were a data object, while it still has the backing of a function to provide constraints.
[Stefan Strasser [strasser@uni-bremen.de] wrote:]
why? there is no widely used practice to use public data objects. so why would you need a property to emulate that syntax?
while you might not consider accessor functions a property in the language construct sense, they do represent a property of the object they're a part of. this is widely used in the C++ standard library and boost. what's the rationale for another properties syntax?