How to protect members of constant object from modification.

Zarathustra adam.chrapkowski at gmail.com
Fri May 30 01:40:22 PDT 2008


For example I have the following class:
//______________________________________________________
class A{
  uint someVariable;
  // other fields and methods...
  static const global;
  
  static this{ global = new A(...); }
}

void
main(){
  // A.global = new A(...); // error, it's ok.
  A.global.someVariable = 3; // no error, it isn't ok
}
//______________________________________________________


More information about the Digitalmars-d-learn mailing list