properties - Why not the set/get syntax?
Cris
central_p at hotmail.com
Sat Apr 1 05:53:48 PST 2006
Cris wrote:
> John C wrote:
>> "Cris" <central_p at hotmail.com> wrote in message
>> news:e0lr0p$2n17$1 at digitaldaemon.com...
>>> How would you implement a write only property?
>>
>> Implement only the setter.
>
> I mean a property that you can write but you cannot read. You can do
> that in C#. Is it possible in D too?
Oh, yes it's possible:
class Bicycle
{
this()
{
gear = 1;
}
int currentGear;
int gear()
{
return currentGear;
}
void gear(int value)
{
currentGear = value;
}
}
So it means that there is absolyutely no difference between properties and
functions in D? Perhaps the notion "property" is a little bit confusing in this case.
More information about the Digitalmars-d
mailing list