Virtual Classes Logo          Virtual Classes
    Read Anytime,Anywhere

Abstraction

Abstraction is one of the concept of object oriented programming. Abstraction is used to display only necessary and essential features of an object and hide un-necessary details to ouside the world( here the world means other classes and assemblies.). Means displaying what is necessary and encapsulate/hide the unnecessary things to outside the world.
Hiding can be achieved by using "private" access modifiers.
If we take an real world example, the electricity wire are under the wall,those wire are hidden from us and we use only current passing through wire with bulb, fan, etc or anything which is connected it.

How to implement abstraction in our programming,
Let's take an example of a car. Car has a name e.g. Maruti- A Star, color of car, steering,gear,brakes, silencer,car engine and other internal machine details etc.
Now lets think as a Car driver. So to drive a car what a car driver should know.
1. Name of Car
2. Color of Car
3. Steering
4. Brakes
5. Gear
Un-necessary things means not that compulsary to know for a Car driver
1. Internal Details of a Car
2. Car Engine
3. Silencer.etc


Now implement this in programming-
Abstractioin Example

As you can see from above code that necessary methods and properties are exposed by using "public" access modifier and un-necessary methods and properties (not compulsary) hidden by using "private" access modifier.