Monday , July 4 2022
Home / C# / C# – Encapsulation

C# – Encapsulation


Encapsulation in a nutshell is “hiding the data“. It restricts direct access to data of an object.

Encapsulation can be applied to data members or methods.

It is done by putting the “private” keyword before the class property name or method name.

Private – A member is private and accessible to only members of the class but not outside the class.
Public – Accessible anywhere by other objects or users.

A well encapsulated class would be in which data members are only accessible through its methods/functions only.



Learn more in this video:


About Waleed Baig

I am doing BS Computer Science. I have a passion to learn new technology and spread it. I am more enthusiastic about learning complex algorithm and making creative and efficient solution to a problem.

Check Also

C# – More on arrays, loops and conditionals (Part 2)

  This is the 2nd part of: More about arrays, loops and conditionals (Part 1) Part 2: …

Leave a Reply

Your email address will not be published.