Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to achieve abstraction ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know we can achieve inheritence with the help of the keyword
i know we can achieve encapsulation by keeping my instance variable private and providing setters and getters method public
i know we can see polymorphism by creating the reference of super class and object of base class like and i also know run and compile time polymorphism
but my question is how to achieve abstraction ?
i think getter methods provide abstraction but i m not clear with that can any one explain me this ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abstraction means that a class represents something in real life. Whichever data you want about the real-life object, you create a class which has the same data, and the class acts as an abstraction.

If a person has name and age, then a Person class with name and age fields acts as an abstraction of a Person. If you want to do anything with those data, the class (or more precisely the instance) does that too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic