@property - take it behind the woodshed and shoot it?
BLM768
blm768 at gmail.com
Sat Aug 10 10:48:32 PDT 2013
On Saturday, 10 August 2013 at 10:29:51 UTC, Stian Pedersen wrote:
> To add to the mess - or maybe suggest a new approach, what
> about:
>
> class A
> {
> int foo();
> void foo=(int a);
> private foo_;
> }
>
> Then a.foo = 42; calls the foo= method. No other conversions
> from a=b to a method invocation.
>
> It may be suggested in one of these 46 pages which I haven't
> read. And it'll probably break a lot of stuff.
The problem with this approach is that the getter is still
operating under the semantics of a method, but, as a property, it
should be acting like a field. An approach like this would work:
class A {
More information about the Digitalmars-d
mailing list