30 Jul 2015

Concept of Abstraction

Abstraction is one of the concept of Object Oriented Programming.
In simple terms Abstraction means showing only functionality to user and hiding internal details.End user will not come to know how a particular functionality is implemented .Concentrate on how to use a function rather to think how function is coded.

How to achieve Abstraction ?
Abstraction can be achieved in following two ways:
  • Abstract Class
  • Interfaces
Abstract class:
  • Abstract class is a class which is declared with keyword Abstract and this can not be instantiated.
  • Can have abstract or non abstract methods
  • Abstract class achieves 0 to 100% abstraction.
Interface :
  • Interface is a class which is declared with keyword Interface and has only abstract methods.
  • Interface is a contract /rules /blue print of a class
  • Interface achieves 100% abstraction.
3 years ago
@wardhaman - I guess it'd be more interesting and useful if you could post some code showing the concept in action. That should help lot of fellow newbie programmers. 😀
Mukta Madankar

Mukta Madankar

Aeronautical
3 years ago
Learn the Design Pattern - you will understand the difference well. Show us some code explaining the same, It would be helpful for us to understand the concept you explained here.
3 years ago
Kaustubh Katdare
@wardhaman - I guess it'd be more interesting and useful if you could post some code showing the concept in action. That should help lot of fellow newbie programmers. 😀
thanks a lot for your suggestion , I will try to explain with the aid of examples.

Share this content on your social channels -

Only logged in users can reply.