When a data member declaration includes a ReadOnly
modifier, assignments to the data members introduced by the declaration may only occur as part of the declaration or in a constructor in the same class. Specifically, assignments to a read-only data member are permitted only in the following contexts:
A shared read-only data member is useful when a symbolic name for a constant value is desired, but when the type of the value is not permitted in a constant declaration or when the value cannot be computed at compile time by a constant expression.
Constants and read-only data members have different binary versioning semantics. When an expression references a constant, the value of the constant is obtained at compile time, but when an expression references a read-only data member, the value of the data member is not obtained until runtime.