Encapsulation and abstraction is important part of C sharp programming that is very used for hide complex code from unauthorized users and shows only relevant information of users.
What is encapsulation?
Encapsulation is the way of hiding irrelevant data from the users. To understand encapsulation, consider an example of computer . Whenever you buy a computer, 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 computer 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 users.
What is abstraction?
Abstraction is just opposite of Encapsulation. Abstraction is mechanism to show only relevant data to the users. Consider the same computer example again. Whenever you buy a computer, you see their different types of computer as TFT Screen, LED Screen,Front Camera , video calling function, recording function, multimedia etc. It is abstraction, because you are seeing only relevant information instead of their internal engineering.