Sunday, 27 March 2016

Real Life Example of Abstraction

Real Life Example of Abstraction


Hello, friend here we discuss Abstraction and Real life example of Abstraction.
Abstraction means providing essential features without showing its inner details or hiding the internal implementation.
Real Life Example of Abstraction

We can enhance the internal implementation without affecting the outside world. Abstraction provides security. A class contains a lot of data and the user does not need the entire data.

Advantage of Using Abstraction

The main advantage of abstraction is that every user will get his own view of the data according to his requirements and will not get confused with unnecessary data.

Example

public abstract class Bank
{
private int accno;
private String name;
void display_to_clerk()
{
System.out.println ("Accno = " + accno);
System.out.println ("Name = " + name);
}
void display_to_manager ()
{
System.out.println ("Accno = " + accno);
System.out.println ("Name = " + name);
System.out.println ("Loan = " + loan);
System.out.println ("Balance = " +balance);
}
}

Real-life Example of Abstraction 

The simple and easy real-life example of Abstraction is a car we know about how to drive a car but we can't know its internal working.

No comments:

Post a Comment