Encapsulation and abstraction is the advanced mechanism in C# that lets your program to hide unwanted code within a capsule and shows only essential features of an object. Encapsulation is used to hide its members from outside class or interface, whereas abstraction is used to show only essential features.
In C# programming, Encapsulation uses five types of modifier to encapsulate data. These modifiers are public, private, internal, protected and protected internal. These all includes different types of characteristics and makes different types of boundary of code.
Encapsulation and abstraction is essential part of C sharp programming that is mostly used for hide complex code from unauthorized user and shows only relevant information.
Encapsulation is the process of hiding irrelevant data from the user. To understand encapsulation, consider an example of mobile phone. Whenever you buy a mobile, you don’t see how circuit board works. You are also not interested to know how digital signal converts into analog signal and vice versa. These are the irrelevant information for the mobile user, that’s why it is encapsulated inside a cabinet.
In C# programming, we will do same thing. We will create a cabinet and keep all the irrelevant information in it that will be unavailable for the user.
Abstraction is just opposite of Encapsulation. Abstraction is mechanism to show only relevant data to the user. Consider the same mobile example again. Whenever you buy a mobile phone, you see their different types of functionalities as camera, mp3 player, calling function, recording function, multimedia etc. It is abstraction, because you are seeing only relevant information instead of their internal engineering.
আমি ওয়েব টিউটর। বিশ্বের সর্ববৃহৎ বিজ্ঞান ও প্রযুক্তির সৌশল নেটওয়ার্ক - টেকটিউনস এ আমি 8 বছর 12 মাস যাবৎ যুক্ত আছি। টেকটিউনস আমি এ পর্যন্ত 4 টি টিউন ও 1 টি টিউমেন্ট করেছি। টেকটিউনসে আমার 0 ফলোয়ার আছে এবং আমি টেকটিউনসে 0 টিউনারকে ফলো করি।