What is the role of private and public access modifiers in encapsulation?
- Private → Hides data from outside access, ensuring security.
- Public → Provides controlled access through properties or methods.
Example:
private decimal balance; // hidden
public decimal Balance { get { return balance; } } // read-only
access