x.sizeof vs typeid(x)
Sergey Gromov
snake.scaly at gmail.com
Wed Feb 6 15:16:58 PST 2008
Robert Fraser <fraserofthenight at gmail.com> wrote:
> From my limited experience with C#, I know there's some kind of special
> property syntax. Maybe something like this would be a better solution?
>
> private double myDistance;
> public property distance
> {
> double __get { return myDistance; }
> void __set(double val) { myDistance= val; }
> double* __addressOf { return &myDistance; }
> }
>
> double x = distance; // x = distance.__get();
> distance = 50.0; // distance.__set(50.0);
> double* p = &distance; // p = distance.__addressOf();
>
> And maybe add more property-properties as needed. This would make them
> first-class, fully interchangeable with variables.
Yes, this would be far more consistent of course. I've just tried to
keep to the current syntax and semantics as close as possible.
--
SnakE
More information about the Digitalmars-d
mailing list