Junior From PDF OOP C# OOP

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

ccess

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details