Abstraction

Abstraction is a concept in Object oriented programming where only required behavior and property will be shown/visible to the user/application.

In Java, data abstraction can be done in Java using abstract class / Interfaces.

Abstract Class are classes where we cannot create objects, however classes which are extending have to implement those functionalities, not defined in the abstract classes.

In this abstract class we have abstract methods like addition,subtract,multiply & division., which are classes where any type of calculator should have.
However for a child class (like a LowLevelCalculator or AdvancedCalculator) to behave as a calculator, it needs to define addition,subtract,etc., methods.

For anybody who is using this calculator abstract class, default will have functionalities, however implementation will not be visible to User.

Here calculator is a object, where it has the implementation of addition() method from AdvancedCalculator indirectly.

Leave a Reply

Your email address will not be published. Required fields are marked *