Hello,

Is the D way to make read-only symbols (of a class, struct, module) to write a 
getter for a private symbols?

Additional question: just realised one can omit () on func calls! Is this 
systematic when a func has no param? I thought it was not the case, because it 
does not work with writeln (the first func on which I tried, indeed!). Is it 
only because writeln is parameterized (with (T...)) or is there any other 
reason I'm not aware of?

struct P {
    private int my_i;
    int i() {return this.my_i;}
    void doit() {writeln("...doing...");}
}
void main () {
    auto p = P(1);
    writeln("p.i: ",p.i);
    p.doit;
}


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com

Reply via email to