+ 1

What is encapsulation in c#?

With example

31st Aug 2021, 5:52 PM
Divya Bagal
Divya Bagal - avatar
2 Respuestas
+ 2
Think of it as a capsule with some stuff in it, each capsule is unique and sometimes one is not allowed to see what the other one has inside
31st Aug 2021, 5:55 PM
Tim
Tim - avatar
+ 2
Now imagine a wall full of pictures or information that each of them can access one another, that's something you would not call encapsulation Sorry if I'm being figurative, but it helps me understand it better that way 😉 Check out this article for a literal explanation: https://www.techopedia.com/definition/3787/encapsulation-c#:~:text=Encapsulation%2C%20in%20the%20context%20of%20C%23%2C%20refers%20to,a%20class%20to%20the%20code%20outside%20the%20class
31st Aug 2021, 5:55 PM
Tim
Tim - avatar