The principle of least privilege is fundamental to good software engineering. In the context of an app, the principle states that code should be granted the amount of privilege and access needed to accomplish its designated task, but no more. Let’s see how this principle applies to instance variables.
Some instance variables need to be modifiable, and some do not. In Section 8.4, we used keyword
const for declaring constants. These constants must be initialized to a constant value when they’re declared. Suppose, however, we want to initialize in the object’s constructor a constant belonging to a specific object of the class. C# provides keyword readonly to specify that an instance variable of an object is