Abstraction in C#

Abstraction

Abstraction is one of the principle of object oriented programming . It is the concept of display only the necessary and essential features of an object .You can find the concept of Abstraction in your real world in many instances .

Example for Real world Example : The simple and well known example is steering of the car . if you turn the steering to right the wheels will be moved to right .hence As a driver you will be instructed to use the steering as the essential feature to drive instead of explaining the internal mechanism how the wheels worked .

How to Implement in Your Real time Project?

For the Beginners , it is important to implement oops concept in your code as it indicates the quality of your code . You can implement abstraction in many ways . The best and simple way is using property procedures

Code
  1. public class Employee  
  2. {  
  3.     private int pSal;  
  4.     public int sal  
  5.     {  
  6.         get  
  7.         {  
  8.             return pSal;  
  9.         }  
  10.         set  
  11.         {  
  12.             pSal = value;  
  13.   
  14.         }  
  15.   
  16.     }  
  17. }