@property get/set or public varaible?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 4 09:39:21 PST 2016


On Sunday, 4 December 2016 at 15:30:22 UTC, vladdeSV wrote:
> Are there any other reasons to use get/setters?

basically, no. as you can omit parentheses in D, converting to 
getter/setter later should be seamless.

the only reason to have getter/setter in your case is a situation 
where you may want to override 'em in child class. so if you are 
using class hierarchy, take some time to think if you will ever 
need such overrides.


More information about the Digitalmars-d-learn mailing list