Practical difference between a struct with const members and with mutable members?

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 9 09:07:36 PDT 2016


I'm mainly coming from languages that haven't got structs, let 
alone the kind of differentiation D offers between 
mutable/immutable/const/etc variables, so I'm still trying to 
work out just when to use each - What's different between these 
two examples, practically speaking? When would you use one over 
the other?

struct thing1{
     const int x, y;
}

struct thing2{
     int x, y;
}

Thanks!



More information about the Digitalmars-d-learn mailing list