What is the use of properties in encapsulation?
- Properties provide controlled access to private fields.
- Enable validation, read-only/write-only access, and future flexibility.
Example:
private int score;
public int Score
get { return score; }
set { if (value >= 0) score = value; } // validation