blog

Home / DeveloperSection / Blogs / Abstraction with example

Abstraction with example

Anonymous User697 30-Aug-2018

ABSTRACATION

It is a process of hiding internal details and showing only relevant data to the object. For implementing it we have to use abstract classes and interfaces.

Suppose we have a record of the employee in a company as given below

• Full name

• Employee ID

• Address

• Contact number

• Hobbies

• Favorite book etc.

  We need to select only relevant information of employee like

• Full name

• Employee ID

• Address

• Contact number

Since we fetched only selected information this is called Abstraction.

Same extracted information from a data can be used for other applications also e.g. banking application, job portal application etc. with little or no modification. Hence it becomes your master data.

 Example: Sending SMS in which you just type the message you need to worry about other processing of message delivery.

It can be achieved using an abstract class and abstract method in java.

Abstract class:

A class which is declared abstract it may or may not contain abstract methods.it cannot be instantiated.

Abstract Method:

A method without a body is known as an abstract method.it must be declared in the abstract class. It should not be final.

Advantages of abstraction:

• It reduces the complexity of the design and implementation process of software.

• It allows you to group several relatable classes as siblings



Updated 30-Aug-2018
I am a content writter !

Leave Comment

Comments

Liked By