Is defining get/set methods for every field overkill?
Sat Nov 19 05:42:03 UTC 2022
On Saturday, 19 November 2022 at 04:47:57 UTC, thebluepandabear
wrote:
>> https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms229042(v=vs.100)
>
> Thanks, I'll think about it more -- I am a noob so I may be
> wrong in what I am saying.
>
> Of course in C# this argument wouldn't exist because you could
> just do `{ get; set; }`, and I really wish D had something
> similar 😂
It does.
private int myVariable;
public Get_myVariable(){}
public Set_myVariable(){}
those public Get/Set members functions are exactly what you get
in C#, except the compiler does it for you, behind the scenes,
saving you the keystokes.. but the end code is just as if you had
typed them out yourself.
More information about the Digitalmars-d-learn
mailing list