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 ?
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.