Readonly-to-outside variable

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 28 12:30:04 PDT 2015


Is there any way to define a variable or an attribute as 
read-only without defining a getter function/method for it?

Thoughts behind this question are:
1. For every reading, another function call process for CPU while 
it could directly read the value from memory.

2. Repetition of same name for variable and getVariableName. 
(Some might not agree with this but I like the code when it looks 
nice.)



More information about the Digitalmars-d-learn mailing list