Is defining get/set methods for every field overkill?


Sat Nov 19 03:35:43 UTC 2022


On Saturday, 19 November 2022 at 03:24:41 UTC, thebluepandabear 
wrote:
>
> I think because of uniform function call syntax, 
> getters/setters are not needed even for production level code, 
> in D of course. In Java, you do need them so your point holds 
> true in that scenario, but in D I don't really see the point 
> after giving it some thought, I would say they are code bloat.

I like to see an example, of a 'class type' with 'public' member 
variables, somehow magically converted into both getter and 
setter using UFCS, without breaking client code.




More information about the Digitalmars-d-learn mailing list